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

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 4 5 6 7 8 9 10 11 12 13 14 int Addodd (struct Node * head) { struct Node temp head; int sum = 0; if (head == NULL) { printf("List is empty!"); return 0; } while (temp == NULL) { if (temp->data82 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

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!