Skip to content

The C code implements a stack using a linked list. It allows users to push, pop, and display elements in the stack. Error handling for overflow and underflow is included.

Notifications You must be signed in to change notification settings

sanjanatg/Stack-implementation-using-Singly-linked-list-in-C.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

stacks-using-singly-linked-list

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.

About

The C code implements a stack using a linked list. It allows users to push, pop, and display elements in the stack. Error handling for overflow and underflow is included.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages