Stack can be implemented using array. The following are the basic operations:
push: Add an element to the top of the stack.
pop: Remove the top element from the stack.
push(element)
if stack is full
return stack overflow
top = top + 1
stack[top] = element
Pseudocode for pop operationpop()
if stack is empty
return stack underflow
element = stack[top]
top = top - 1
return element
1. push
2. pop
3. exit
Enter your choice: 1
Enter element: 10
1. push
2. pop
3. exit
Enter your choice: 1
Enter element: 20
1. push
2. pop
3. exit
Enter your choice: 2
Element popped: 20
1. push
2. pop
3. exit
Enter your choice: 2
Element popped: 10
1. push
2. pop
3. exit
Enter your choice: 3