Question
Create a stack using a linked list. For this implementation you will create 2 functions push and pop. Then your program will input any number
Create a stack using a linked list. For this implementation you will create 2 functions push and pop. Then your program will input any number of letters and then pop them off showing them in reverse order.
Your program should have a menu that looks like:
Push
pop
exit
This should be in a while loop so that you can put things on the stack and take them off as you see fit and keep doing either push or pop until you see exit.
On exit close the program.
TIPS:
Make sure to check for the empty stack on pop - if it is empty you cannot pop
Make sure to check the status of the malloc in push - if it returns an error then you cannot push that would mean memory is full (look up the error returns)
Make sure to free memory after each pop operation for the thing you pop
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started