Last active
July 29, 2019 19:52
-
-
Save devansh42/79b5005d286567645d46db94cc3db746 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void delete_list(LinkedList* list){ | |
Node* i; | |
/** | |
* Deallocating memory associated with each node | |
* Starting from head node | |
* Ends whenever we reach at the end | |
* We go to next node in each iteration | |
*/ | |
for(i=list->head;i;i=i->next){ //Traversing Linked List | |
free(i); //Deallocatind memory of i'th node | |
} | |
free(list); //Freeing memory for LinkedList object | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment