Homework/HW03/ListNode.cc
void deleteList(ListNode *head)
{
    ListNode *temp;
    while (head) // we still have nodes to delete
    {
        temp = head;       // store the current node
        head = head->next; // move the head to the next
        delete temp;       // now we can delete it
    }
}
// Delete the entire list starting from the target object.
Delete the entire list starting from the target object.
Delete the entire list starting from the target object .
void deleteList(ListNode *head)
{
    ListNode *temp;
    while (head) 
    {
        temp = head;       
        head = head->next; 
        delete temp;       
    }
}
void deleteList ( ListNode * head ) { ListNode * temp ; while ( head ) { temp = head ; head = head -> next ; delete temp ; } }
Delete the entire list starting from the target object.
Delete the entire list starting from the target object .
// we still have nodes to delete // store the current node // move the head to the next // now we can delete it