So I'm dealing with some linked lists and I was wondering if I have to free every node in the list or will just freeing the head of the list do the trick?
So I'm dealing with some linked lists and I was wondering if I have to free every node in the list or will just freeing the head of the list do the trick?
You need to free() every node, assuming you allocated each node separately. For every allocation, there should be a corresponding free(), always.
If you understand what you're doing, you're not learning anything.