It may be noted that if more pop operations are done on the stack then a stage will come when
there will be no items left on the stack. This condition is called stack empty.
The algorithms for push and pop operations are given below. These algorithms use an array called
Stack[N] to represent a stack of N locations. A variable called Top keeps track of the top of the
stack
, i.e., the location where additions and deletions are made. Another variable called item is used to
store the item to be pushed or popped from the stack.
Similarly, the nested calls to functions and procedures are also handled in LIFO fashion in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.