Q893
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; int len = get_len(); printf("%d",len); return 0;
A.
0
AnswerB.
Garbage value
C.
Compile time error
D.
Runtime error
Answer: Option A
Solution
Answer: Option A
No explanation is given for this question Let's Discuss on Board