Question: second part of code Question 1(25 points): The following code implements the following: 1) Push five integer values into a stack. 2) Pop all values

Question 1(25 points): The following code implements the following: 1) Push five integer values into a stack. 2) Pop all values from the stack then store the popped values in a linked list and print it on the screen. However, some parts of the code are missing (indicated by Complete the missing parts. #define STACKSIZE 5 struct stack { int items [STACKSIZE]; _top; }; struct node { int data; _next; }; typedef struct node* void push(struct stack , int); int pop(struct stack *); void insert(node "head, int); int main(void) { -S; s.top = for (int i = 0; i data = x; head->next = for (int i = 1; i top -1) { printf("- exit(1); } else { -"); X = ps->top } return x; } void push(struct stack *ps, int x) { if (ps->top -- STACKSIZE - 1) { printf("- exit(1); } else { ps->top = ps->---- X; } } void insert(node* head, int x) { node *p = (NODEPTR)malloc(sizeof(struct node)); p->data = x; p->next = NULL; node *cur = head; while (---- --) { if (cur->next == NULL) { break; } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
