Stack Operations Project
Stack Operations Project
Class: XII
Board: WBCHSE
Index
1. Introduction
2. Flowchart/Algorithm
3. Program Code
4. Output
5. Conclusion
1. Introduction
A stack is a linear data structure that works on the principle of Last In First Out (LIFO), meaning that
the last element inserted is the first one to be removed. This project demonstrates the following
stack operations:
2. Algorithms
Push Algorithm:
1. Start.
5. End.
Pop Algorithm:
1. Start.
5. End.
Display Algorithm:
1. Start.
3. Loop through the stack from top to bottom and print each element.
4. End.
if (top == MAX - 1) {
printf("Stack Overflow\n");
} else {
top++;
stack[top] = element;
void pop() {
if (top == -1) {
printf("Stack Underflow\n");
} else {
top--;
void display() {
if (top == -1) {
printf("Stack is Empty\n");
} else {
int main() {
push(10);
push(20);
push(30);
return 0;
4. Output
Example 1: Push Operation
30
20
10
Popped element: 30
Stack elements are:
20
10
5. Conclusion
In this project, we successfully implemented stack operations using C, covering basic functions such
as pushing, popping, and displaying elements. The program effectively handles the overflow and
underflow conditions. Stacks are highly useful in managing data for various applications such as