Skip to content

Instantly share code, notes, and snippets.

@dmdevoss
Created October 7, 2014 15:15
Show Gist options
  • Select an option

  • Save dmdevoss/211622f8835a04b2dc75 to your computer and use it in GitHub Desktop.

Select an option

Save dmdevoss/211622f8835a04b2dc75 to your computer and use it in GitHub Desktop.
Non-recursive free nodes in C
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