Hey,
I have a circular linked list, and I'd like to fee the memory that I've malloc'd .
I tried doing this
But as a check to see if it works, I print the list after, and it prints perfectly, indicating that the memory was not cleared. What am I doing wrong?Code:listnode temp; listnode current=NULL; temp=head; while(temp!=NULL) { current=temp; current=current->previous; free(temp); temp=current; }
Thanks!