Examveda

Consider the following iterative implementation used to find the length of a linked list:
struct Node
{
      int val;
      struct Node *next;
}*head;
int get_len()
{
      struct Node *temp = head->next;
      int len = 0;
      while(_____)
      {
          len++;
          temp = temp->next;
      }
      return len;
}
Which of the following conditions should be checked to complete the above code?

A. temp->next != 0

B. temp == 0

C. temp != 0

D. temp->next == 0

Answer: Option C


This Question Belongs to Data Structure >> Miscellaneous On Data Structures

Join The Discussion

Related Questions on Miscellaneous on Data Structures