There's some mistake I made is my function to delete all the nodes in my linked list and I don't know what it is. I get some sort of memory error. I'll just post the code for the function because you don't really need to see all of the class and stuff...
I get the error if the variable head points to a node and when head->next = 0. It won't finish even one iteration of the loop, the error occurs somewhere in the block for the if statement "if(temp2)". I know that even if temp2 = 0 that it executes the code inside that if statement. Any help would be greatly appreciated.Code:string::~string() { node * temp1 = head; node * temp2 = head->next; while(temp1 || temp2) { delete temp1; if(temp2) if(temp2->next) temp1 = temp2->next; delete temp2; if(temp1->next) temp2 = temp1->next; } }



LinkBack URL
About LinkBacks


