Q199
What is the output of the following code? #include #include struct Node int val; struct Node *next; *head; int get_len() struct Node *temp = head->next; int len = 0; while(temp != 0) len++; temp = temp->next; return len; int main() int arr[10] = 1,2,3,4,5, n = 5, i; struct Node *temp, *newNode; head = (struct Node*)malloc(sizeof(struct Node)); head->next = 0; temp = head; for(i=0; i val = arr[i]; newNode->next = 0; temp->next = newNode; temp = temp->next; int len = get_len(); printf("%d",len); return 0;
A.
4
B.
5
AnswerC.
6
D.
7
Answer: Option B
Solution
Answer: Option B
No explanation is given for this question Let's Discuss on Board