Follow these steps to implement a stack using a linked list:
- A structure is defined called node. In this structure, besides a data member for storing content for the stack, a pointer is also defined that points to the next node.
- The top pointer is initialized to NULL to indicate that the stack is currently empty.
- A menu is displayed and the user is asked whether they want to push or pop from the stack. The user can enter 1 to indicate that they want to push a value to the stack or enter 2 to indicate that they want to pop a value from the stack. If the user enters 1, go to step 4. If they enter 2, go to step 9. If they enter 3, it means they want to quit the program, so go to step 13.
- Allocate memory for the new node.
- Ask ...