Two Basic Operations on Stack 

  • PUSH
  • POP

Push and Pop operation in stack in C : Algorithm

  • PUSH(Stack, N, Item)

This algorithm will insert Item at top to Stack having size N. Here initial index for stack is 0.

        
PUSH operation in stack in c program
Copy to Clipboard

  • POP(Stack, N)

This algorithm will delete the top element from the Stack having size N. Here initial index for stack is 0.

POP operation in stack in c program
Copy to Clipboard


C program to implement push and pop operations on a stack using an array is as follows:

Copy to Clipboard

Output :

Copy to Clipboard