Skip to content

Instantly share code, notes, and snippets.

@chintanparikh
Created November 28, 2012 22:24
Show Gist options
  • Select an option

  • Save chintanparikh/4165137 to your computer and use it in GitHub Desktop.

Select an option

Save chintanparikh/4165137 to your computer and use it in GitHub Desktop.
removeNode
void removeNode(struct node** headRef, struct node* del)
{
if (del == NULL || *headRef == NULL)
{
return;
}
if (*headRef == del)
{
*headRef = del->next;
}
if (del->next != NULL)
{
del->next->previous = del->previous;
}
if (del->previous != NULL)
{
del->previous->next = del->next;
}
free(del);
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment