Solved

Given the Following Function Declaration

Question 46

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