Solved

What Is Wrong with the Following Definition of HeadInsert

Question 48

Multiple Choice

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:

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