Created
October 7, 2014 15:15
-
-
Save dmdevoss/211622f8835a04b2dc75 to your computer and use it in GitHub Desktop.
Non-recursive free nodes in C
This file contains hidden or 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 free_list(node** head){ | |
| while(*head){ | |
| node* next = (*head)->next; | |
| (*head)->next = NULL; | |
| free(*head); | |
| *head = next; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment