An Abstract Data Type (ADT), typically used in the majority of programming languages, is a stack. It is called a stack since, for example, it looks like a real-world stack, a deck of cards or a pile of plates, etc.

This feature enables the structure of LIFO data. For Last-in-first-out, LIFO stands for. Here, the element that is last positioned (inserted or added) is first accessed. In stack terms, the insertion process is called the process of PUSH and the operation of removal is called the operation of POP.
Stack Representation
The following diagram depicts a stack and its operations−

A stack can be implemented by means of Sequence, Order, Pointer, and Linked List. Stack can be either a fixed size one or it can have a feeling of dynamic resizing. Here, to implement the stack, we will use arrays, which makes it a stack implementation of a fixed size.
Basic Operations
Initialization, use and then de-initialization of the stack can involve stack operations. For the two main operations that follow, a stack is used in addition to these basic objects.
push() − Pushing (storing) an element on the stack.
pop() − Removing (accessing) an element from the stack.
Push Operation
The process of putting a new data element onto stack is known as a Push Operation. Push operation involves a series of steps −
Step 1 − Checks if the stack is full.
Step 2 − If the stack is full, produces an error and exit.
Step 3 − If the stack is not full, increments top to point next empty space.
Step 4 − Adds data element to the stack location, where top is pointing.
Step 5 − Returns success.

If the linked list is used to implement the stack, then in step 3, we need to allocate space dynamically.
Algorithm

Pop Operation
A Pop operation may involve the following steps −
Step 1 − Checks if the stack is empty.
Step 2 − If the stack is empty, produces an error and exit.
Step 3 − If the stack is not empty, accesses the data element at which top is pointing.
Step 4 − Decreases the value of top by 1.
Step 5 − Returns success.

Algorithm
