|
|
|
|
|
by ramLlama
4993 days ago
|
|
When you start the list traversal, you would have something like 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: