Question: Problem 2: Correct the code 20 Points The function Addodd takes as input the head pointer of a linked list of integers. A Node has

Problem 2: Correct the code 20 Points The function Addodd takes as input the head pointer of a linked list of integers. A Node has two fields: data (int) and a pointer to a Node called next. This function checks all the nodes one by one, and adds all the odd integers. There are five errors in the below code. Identify them, and correct the code. Write your answer in the second table. 1 2 3 int Addodd (struct Node * head) { struct Node temp = head; int sum = 0; if(head == NULL) { printf("List is empty!"); return 0; 4 5 6 7 8 9 10 11 12 13 14 while temp == NULL) { if (temp->datat2 == 0) sum = sum + temp.data; temp = temp + 1; return sum; Your answer: Line Corrected code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
