Skip to content

Instantly share code, notes, and snippets.

@gerow
Last active December 25, 2015 12:59
Show Gist options
  • Save gerow/6980111 to your computer and use it in GitHub Desktop.
Save gerow/6980111 to your computer and use it in GitHub Desktop.
struct node {
void *value;
struct node *next;
};
typedef struct node node;
void
delete_node(node **head, node *to_delete)
{
recur:
if (*head == NULL)
return;
if (*head == to_delete) {
*head = to_delete->next;
free(to_delete);
return;
}
head = &(*head)->next;
goto recur;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment