void main () { int stack[MAX_VAL]; int top = -1; pop_element_from_stack (stack, &top); push_element_to_stack (stack, 1, &top); push_element_to_stack (stack, 2, &top); push_element_to_stack (stack, 3, &top); display_stack (stack, top); pop_element_from_stack (stack, &top); display_stack (stack, top); push_element_to_stack (stack, 4, &top); push_element_to_stack (stack, 5, &top); push_element_to_stack (stack, 6, &top); push_element_to_stack (stack, 6, &top); display_stack (stack, top); }
int main() { int i,item; stack STACK; STACK.top=-1; printf("Enter the ten numbers randomly in the stack one by one:\n"); for(i=0;i<5;i++) { scanf("%d",&item); push(&STACK,item); printf("Status of stack after adding integer:\n"); display_stack(&STACK); }getch(); }