Stack SLL
Stack SLL
h>
#include <stdlib.h>
Struct Node {
Int data;
};
Int main() {
While (1) {
Printf(“1. Push\n”);
Printf(“2. Pop\n”);
Printf(“3. Peek\n”);
Printf(“4. Display\n”);
Printf(“5. Exit\n”);
Scanf(“%d”, &choice);
Switch (choice) {
newNode->data = value;
break;
if (top == NULL) {
} else {
Break;
If (top == NULL) {
} else {
Printf(“Top element is %d.\n”, top->data);
Break;
If (top == NULL) {
} else {
Printf(“%d “, current->data);
Current = current->next;
Printf(“\n”);
Break;
Case 5: // Exit
Printf(“Exiting program.\n”);
Exit(0);
Default:
}
Return 0;