Solved

Given the Following Function Declaration

Question 54

Multiple Choice

Given the following function declaration
Void insert NodePtr afterMe, int num) ;
//PRE: afterMe points to some node in the non-empty list
//POST: A new node containing num is inserted after afterMe.
Void insertNodePtr afterMe, int num)
{
// which of the following function definitions correctly implement this //function?
}


A) afterMe->link = new Node; afterMe->link->data = num;
AfterMe -> link ->link=afterMe->link;
B) NodePtr tmp=new Node; tmp-> data = num;
AfterMe -> link = tmp;
Tmp->link = afterMe -> link;
C) NodePtr tmp=new Node; tmp-> data = num;
Tmp->link = afterMe -> link;
AfterMe -> link = tmp;
D) NodePtr tmp=new Node; tmp-> data = num;
AfterMe -> link = tmp;
Tmp->link = NULL;

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