Solved

In the Following Search Function for a Linked List Using

Question 21

Multiple Choice

In the following search function for a linked list using the Node and NodePtr as defined in the text) , why is there code to check if here is NULL?
NodePtr searchNodePtr head, int target)
{
NodePtr here = head;
Ifhere == NULL)
{
Return NULL;
}
Else
{
While here->data != target && here->link != NULL)
{
Here = here->link;
}
Ifhere->data == target)
{
Return here;
}
Else
{
Return NULL;
}
}
}


A) the list may be empty
B) the list may be full
C) there is no reason for that code to be there
D) A and B

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions