Lets examine this for a second :
while(!isEmpty()){
ListNode<char *> *temp = head;
head = head->next;
head->previous = NULL;
delete temp;
}
Assume that the list contains, A,B,C. Where A-C can be anything.
Now your delete function will do this :
//Iteration # 1
1) while(!isEmpty()) is true go the code block will get executed.
2) ListNode *temp = head; Now Type is any data type. Now temp points to the head which points to A.
3) head = head->next; now head points to B
4) head->previous = NULL; now head->previous points to A right? So you are setting A to null. Remember temp points to A, so temp now is null. This is called amemory leak.
5) delete temp; now you delete a null, which does nothing.
//Iteration # 2
//now the list is {null B C }, where null means it does not exist
1) while(!isEmpty()) this is true so the block of code gets executed
2) ListNode *temp = head; Now temp points to the head which points to B.
3) head = head->next; now head points to C
4) head->previous = NULL; now head->previous points to B right? So you are setting B to null. Remember temp points to B, so temp now is null. This is called a memory leak.
5) delete temp; Now you delete a null, which does nothing.
//Iteration # 3
//now the list is {null null C }, where null means it does not exist
1) while(!isEmpty()) this is true so the block of code gets executed
2) ListNode *temp = head; Now temp points to the head which points to C.
3) head = head->next; now head points to null
4) head->previous = NULL; //now you effectively do , null->previous. Which means that you are now using a null points. This is the reason why you get the access violation exception, since head now points to something else that its has the privilege to.
Now your code is very close. Just fix a few things. If you need more hint
then don't hesitate to ask.