Ask your own question, for FREE!
Computer Science 12 Online
OpenStudy (mandre):

What is the best way to do a destructor for a linked list? I've seen cases where people do nothing but set the head to null and other cases where they cycle through the list and delete every node. Does setting the head to null necessarily clean up the whole list or leave data in memory? C++

OpenStudy (anonymous):

Setting the head to null automatically cleans up the whole list. It is the best and the easiest way

OpenStudy (mandre):

Thanks bhavishya

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!