Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For the following code, (3 marks) 12. #include 13. #include 14. struct Node 15. { 16. int data; 17. struct Node next; 18. };
For the following code, (3 marks) 12. #include 13. #include 14. struct Node 15. { 16. int data; 17. struct Node" next; 18. }; 19. typedef struct Node NODE; 20. typedef NODE NODEPTR; 21. void push1(NODEPTR* head_ref, int new_data) { 22. NODEPTR new_node =(NODEPTR) malloc(sizeof(NODE)); 23. new_node->data = new_data; 24. new_node->next = (*head_ref); 25. ("head ref) new_node; 26. void push(NODEPTR head_ref, int new_data) } { 27. NODEPTR new_node =(NODEPTR) malloc(sizeof(NODE)); 28. new_node->data = new_data; 29. new_node->next = ("head_ref); 30. (head ref) new_node; 31. void printList(NODEPTR head) { 32. NODEPTR temp = head; 33. while(temp!= NULL) { 34. printf("%d", temp->data); 35. temp-temp->next; } a. } 36. int main() 37. { 38. NODEPTR head = NULL; 39. int i; 40. push1(&head, 7); 41. for (i=4; 1>0; i--) { 42. push(&head, i); } 43. printf("Given linked list is "); 44. printList(head); 45. } The program output is: }
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