Question: Please design a C program to implement a stack using pointers. Let the user operate the stack and output its content. The user have two

Please design a C program to implement a stack using pointers. Let the user operate the stack and output its content.

The user have two input method:

1)Digit 1+blank space + Number N. This input method is push. The number N is the number to be pushed into the stack. You should refresh the stack status. Ex;(1 23),(1 5), (1, 45) ...

2)Digit 2 . This input method is pop. When it is detected that the users previous input is 2

The top element in the stack should be removed.

The program should let the user input indefinitely until EOF is detected.

The program must contain two functions:

1) Void mypush(int) : It takes an integer N that will be pushed to the stack.

2)Int mypop(): remove the top element in the stack and output the remaining elements of the stack. The function should be able to judge when there is no element to be removed in the stack and print an error message.

Note that the built-in push and pop function cannot be used.

Please design a C program to implement a stack using pointers. Let

Digital x New Tab O Complex pdm.pdf x Inverse x M 1091_CX > Home X Google X M Chegg. X C Get Her x C Digitex + File C:/Users/USER/Downloads/HomeWork11%20(2).pdf DO HomeWork14 (2).pdf 2/3 Please input the instruction:1 444 push 444 into stack. Example: Nothing in stack Please input the instruction:2 Error pop- Nothing in stack. Please input the instruction:1 3 push 3 into stack. 3 444 20. Please input the instruction:1.5 push 5 into stack. Please input the instruction:19 push 9 into stack. Puns 9 Please input the instruction:1 20 push 20 into stack 444 20 20 que Please input the instruction:1 444 Please input the instruction:2 push 444 into stack. pop 9 from stack. Please input the instruction 2 pop 9 from stack RRRRRR

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 Databases Questions!