Question: What is printed after the following code snippet terminates? void solve(struct Node *head) { /* The LinkedList is defined as: head->data = value of
What is printed after the following code snippet terminates? void solve(struct Node *head) { /* The LinkedList is defined as: head->data = value of the node head->next = address of next element from the node The List is 1-2-3->2-> 5 */ int sum = 0; while(head -> next != NULL) { sum += head->data; head-head->next; } printf("%d ", sum);
Step by Step Solution
3.38 Rating (151 Votes )
There are 3 Steps involved in it
The image shows a function written in the C programming language that takes a pointer to the first n... View full answer
Get step-by-step solutions from verified subject matter experts
