Stack Concept : Definition of Stack Data Structure

Concept Of Stack | Definition

We know that the Stack is LIFO Structure i,e Last in First Out. It is very useful data structure in C Programming. Stack can be implemented using the Linked List or Array.

Must Read : Array Representation of Stack

What is Stack ?

  1. Stack is LIFO Structure [ Last in First Out ]
  2. Stack is Ordered List of Elements of Same Type.
  3. Stack is Linear List
  4. In Stack all Operations such as Insertion and Deletion are permitted at only one end called Top

Visual Representation of Stack :

Consider Stack with following details -

FieldValue
Size of the Stack6
Maximum Value of Stack Top5
Minimum Value of Stack Top0
Value of Top when Stack is Empty-1
Value of Top when Stack is Full5

View 1 : When Stack is Empty

When Stack is said to empty then it does not contain any element inside it. Whenever the Stack is Empty the position of topmost element is -1.

View 2 : When Stack is Not Empty

Whenever we add very first element then topmost position will be incremented by 1. After adding First Element top = 0.

View 3 : After Deletion of 1 Element Top Will be Decremented by 1


Position of Top and Its Value :

Position of TopStatus of Stack
-1Stack is Empty
0First Element is Just Added into Stack
N-1Stack is said to Full
NStack is said to be Overflow