Read the following code and determine what goes in blank #1. void RevPrint(NodeT
ID: 3901745 • Letter: R
Question
Read the following code and determine what goes in blank #1.
void RevPrint(NodeType* listPtr)
// Pre: listPtr is an external pointer to a list.
// Post: Values in the list have been printed in reverse order.
{
if (_______________) // 1
{
RevPrint(_________); // 2
cout << __________ << endl; // 3
}
___________ // 4
}
A) listPtr = NULL
B) ListPtr != NULL
C) listPtr->next
D) listPrt->info
Explanation / Answer
Answer: Option B i.e listPtr != NULL
To print the values of list in reverse order (using recursion) , at line #1, we need to check if the list is NOT NULL
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.