Stack Operations
Various stack operations are as follows:
- push()
- pop()
- peek()
push()
It checks if a stack is full, and if it is, then it displays “stack overflow”.
And if it is not full then it increments top to the next location, and assign data to the top element.

pop()
It checks if a stack is empty, and if it is, then it displays “stack underflow”.
If it is not empty then it decrements top to the previous location, and deletes the temporary variable.

peek()
It prints the top most value from the stack.

Reference