STACKS

Definition: The stack is a data structure which follows the principle of LAST IN FIRST OUT
Consider data stored in stack be
1 2 3 4 5 6
Let they be inserted one after the other then stack looks like..

6
5
4
3
2
1
The position of 6 is called TOP position.
Any operation on stack is done on top position.
Let other data 7 need to be inserted in stack then the stack becomes

7
6
5
4
3
2
1
The data to be inserted at top position as the stack principle is Last In First Out.
REMOVE DATA FROM A STACK
The data to be first removed can be element which is on the top.So the element 7 is removed .
In order to remove the data element 1 then the elements on top of it are to be removed first.
Stack can be implemented using stacks and we can even use structures.
The process of inserting elements into a stack is called PUSH
The process of removing element from stack is POP
The operations on stack using a array are explained using arrays
HOPE THIS HELPS...........................
HAPPY CODING..................