Basic Concept of StackPritesh
Basic Concept of Stack : C Data Structure
[box]Stack is first in last out Structure (LIFO) Structure .[/box]
Stack is Data Structure used to store the data in such a way that element inserted into the stack will be removed at last.
Just take real time example, Suppose we have created stack of the book like this shown in the following fig –
How Books are arranged in Stack ? :
- Books are kept one above the other
- Book which is inserted first is Taken out at last.(Brown)
- Book which is inserted Lastly is served first.(Light Green)
Common Example :
Suppose at your home you have multiple chairs then you put them together to form a vertical pile. From that vertical pile the chair which is placed last is always removed first.
Chair which was placed first is removed last. In this way we can see how stack is related to us. We are implementing the stack using C Programming in the upcoming chapters.
Image source : Link