-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctioncall.c
More file actions
27 lines (26 loc) · 831 Bytes
/
Copy pathFunctioncall.c
File metadata and controls
27 lines (26 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
int main() {
int choice, item;
printf("1. Push\n2. Pop\n3. Display\n4. Exit\n");
while (1) {
printf("Enter your choice: ");
scanf("%d", &choice);
switch(choice) {
case 1:
printf("Enter value to push: ");
scanf("%d", &item);
push(item); // Call the push function to insert the entered item onto the stack
break;
case 2:
pop(); // Call the pop function to remove the top item from the stack
break;
case 3:
display(); // Call the display function to show all elements in the stack
break;
case 4:
return 0;
default:
printf("Invalid choice!!\n");
}
}
return 0;
}