Data Structure Using C (313301) Practical No.16: Write a 'C' Program to perform PUSH and POP Operations on Stack using an Array
Stacks are a fundamental data structure in computer science and have numerous practical applications based on their LIFO (Last In, First Out) properties. Hence Stack is Linear Data Structure where insertion and deletion take place only from one end called as Stack Top.
C Program Code
Algorithm
Flowchart
Result (Output of Program)
--- Stack Operations ---
1. Push
2. Pop
3. Display
4. Exit
Enter your choice: 1
Enter the value to push: 23
23 pushed onto the stack.
--- Stack Operations ---
1. Push
2. Pop
3. Display
4. Exit
Enter your choice:
Practical Related Questions
1. Write a C program to perform following operations on Empty stack: a. PUSH (10), PUSH (20), POP, PUSH (10), PUSH (20), POP, POP, POP, PUSH (20), POP.
Answer:
2. Write a C program to reverse a String using Stack.
Answer:
3. Write a C program to check whether the given string is palindrome or not using stack.
Answer:
Exercise
1. Enlist stack applications.
Answer:
- Evaluation of Arithmetic Expressions
- Backtracking
- Delimiter Checking
- Reverse a Data
- Processing Function Calls
2. Consider the following stack and observe how many operations are required to delete the smallest element from given stack.
Answer:
We successfully completed Data Structure Using C (313301) Practical No.16 and Write a 'C' Program to perform PUSH and POP Operations on Stack using an Array.