Solved

In the Following Search Function for a Linked List Using

Question 51

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

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents