Chapter 17: Problem 33
Find as many mistakes as you can. void NumberList::appendNode(double num) { ListNode *newNode, *nodePtr; // Allocate a new node & store num newNode = new listNode; newNode->value = num; // If there are no nodes in the list // make newNode the first node. if (!head) head = newNode; else // Otherwise, insert newNode. { // Find the last node in the list. while (nodePtr->next) nodePtr = nodePtr->next; // Insert newNode as the last node. nodePtr->next = newNode; } }
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.