Data Structures Lab Manual / Data Structures Stack C Program

Program Name: Write a C Program for Linear Seach in Data Structures
Theory
Stack is a data structure which flows first in last out to store the elements. Stack
has 4 operations. They were Push (Adds New elements to stack), Pop (removes elements
from stack), Overflow (Indicates number of elements in the stack exceeds) and 
Underflow (Indicates no more element to pop).
Program Code



Input:
Stack Operations Using Array
 Enter Stack[MAX=20] size: 5

 Enter the Choice: 
 1.PUSH 	 2.POP 	 3.DISPLAY 	 4.EXIT 
1
Enter a value to be pushed into Stack:9

 Enter the Choice: 
 1.PUSH 	 2.POP 	 3.DISPLAY 	 4.EXIT 
2

	 Elements popped are 9
 Enter the Choice: 
 1.PUSH 	 2.POP 	 3.DISPLAY 	 4.EXIT 
3

stack is Empty
 Enter the Choice: 
 1.PUSH 	 2.POP 	 3.DISPLAY 	 4.EXIT 

Output:
Stack Operations Using Array
 Enter Stack[MAX=20] size: 5

 Enter the Choice: 
 1.PUSH 	 2.POP 	 3.DISPLAY 	 4.EXIT 
1
Enter a value to be pushed into Stack:9

 Enter the Choice: 
 1.PUSH 	 2.POP 	 3.DISPLAY 	 4.EXIT 
2

	 Elements popped are 9
 Enter the Choice: 
 1.PUSH 	 2.POP 	 3.DISPLAY 	 4.EXIT 
3

stack is Empty
 Enter the Choice: 
 1.PUSH 	 2.POP 	 3.DISPLAY 	 4.EXIT 



Home     Back