Each of the following member functions has errors in the way it performs a linked list operation. 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;
}
}