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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!