by ramLlama · 14y ago · 0 comments
Node** link = list_head
and as you traverse, you would do link = &(entry->next)
Then, when you find the entry that you want to delete, link points to either (a) list_head if you are deleting the first entry or (b) the next pointer of the previous entry. Either way, doing *link = entry->next
does the trick.This way, you save on the conditional branch.
You could do something like this instead:
link = &((*link)->next); *link = (*link)->next;