Stack Implementation using Singly Linked List
This C program implements a stack data structure using a singly linked list. Stacks follow the Last-In-First-Out (LIFO) principle, where the last element added is the first one to be removed.
Key Features:
-Insertion (Push): Adds an element to the top of the stack.
-Deletion (Pop): Removes the topmost element from the stack.
-Display: Prints the elements of the stack in the order from top to bottom.
-Stack Overflow/Underflow Handling: Prevents the stack from exceeding its maximum size or becoming empty.
Input:
The program will prompt you to enter the maximum size of the stack.
You'll then be presented with a menu to choose from the following operations:
1: Push an element onto the stack
2: Pop an element from the stack
3: Display the stack and exit
Output:
The program will display appropriate messages for stack overflow, underflow, and successful operations.
It will also print the elements of the stack when you choose to display them.