void push(stackT *stackP, stackElementT element){ if(fullStack(stackP)){ fprintf(stderr, "Can't push element on stack: stack is full. \n"); exit(1); } stackP->contents[++stackP->top] = element; }
///******************************** ///Function: push ///Task: if the stack is not full, increments the topIndex int and adds an element to the top of the stack ///Returns: nothing ///******************************** void calcStack::push(double number) { if (isFull()) { throw fullStack(); } topIndex++; nums[topIndex] = number; }
int push(struct Stack *stack, long data) { if (fullStack(stack)) { fprintf(stderr, "%s", "\nfull stack!\n"); return -EFULLSTACK; } stack->stack[stack->sp++] = data; return 0; }