stack stack is an abstract data type (adt)commonly used in most programming languages it is named stack as it behaves like real-world stackfor example deck of cards or pile of platesetc real-world stack allows operations at one end only for examplewe can place or remove card or plate from the top of the stack only likewisestack adt allows all data operations at one end only at any given timewe can only access the top element of stack this feature makes it lifo data structure lifo stands for last-in-first-out herethe element which is placed (inserted or addedlastis accessed first in stack terminologyinsertion operation is called push operation and removal operation is called pop operation stack representation the following diagram depicts stack and its operations stack can be implemented by means of arraystructurepointerand linked list stack can either be fixed size one or it may have sense of dynamic resizing herewe are going to implement stack using arrayswhich makes it fixed size stack implementation basic operations stack operations may involve initializing the stackusing it and then de-initializing it apart from these basic stuffsa stack is used for the following two primary operations push(pushing (storingan element on the stack