Stack:
- Stack is a linear data structure.
- Stack follows LIFO (Last in First Out).
- Elements added from one end called TOP of stack and removes from the same end.

Note: We create Stack using arrays, only the way of representation and Rules of accessing elements vary.

Array | Stack |
Linear data structure | Linear data structure |
Process elements using Index | Process element using TOP |
Insert element any where | Insert at top only |
Delete element from any where | Delete from top |
Display element in any format | Display elements in LIFO |
Work flow:

Stack ADT: Abstract Data Type specifies the operations can be performed on Stack
- Push: Push an element on to the Stack. Returns “Overflow” if stack is full.
- Pop: Deletes top item from Stack. Returns “Underflow” if Stack is empty.
- Peek: Returns top element of stack but not removes.
- isEmpty: Returns true if stack is empty, else false
- isFull: Returns true if stack is full, else false
- Traverse: Display elements of Stack.
We can create the Stack in two ways:
- Static Stack: Stack with fixed size and can be created using Arrays.
- Dynamic Stack: Stack modifies dynamically and can be created using Pointers.
Stack using Arrays:
- Create an array with name Stack.
- We can specify the size using Macro(Constant variable).

Global variables: Define Array variable and top as global so that we can access from all functions
