What is wrong with the following definition of headInsert?
Struct Node
{
Int item;
Node* link;
};
Typedef Node* NodePtr;
Void headInsertNodePtr& head, int data)
{
NodePtr tmp = new Node;
Tmp->item = data;
Head->next = tmp;
Tmp->next = head->next;
}
NodePtr head;
HeadInserthead, 4) ;
A) head->next is pointing to NULL
B) if there were any nodes following head they are now lost.
C) nothing is wrong.
D) tmp should be declared to be a Node not a NodePtr
Correct Answer:
Verified
Q43: If NodeTypePtr is defined to be a
Q44: Given the following declarations, which statement would
Q45: The actual value of NULL is
A) -1
B)
Q46: As defined in the text, the pointer
Q47: If you need to access the last
Q49: Given the following stack declaration, which of
Q50: What happens if you have two lists
Q51: In the following search function for a
Q52: To add an item to a stack,
Q53: Given a linked list using the code
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents