-
Deleting linked lists...
Not too sure what I'm doing wrong here. Hopefully someone can shed some light on it for me :)
When deleting a linked list, is it ok to simply do:
Code:
delete [] linked_list;
or should you step through each item in the list and delete that?
hope the question isn't too vague. If it is, complain and I'll fix it. :)
-
> step through each item in the list and delete that
Yes. From an object oriented perspective, you should have your lists's destructor delete each node it has in the list.
-