Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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