4 ms·
When an object O is deleted, it needs to be removed from the linked list by patching the pointer that led to O to lead to O->next instead. There are two cases:
by edflsafoiewq 4y ago
When an object O is deleted, it needs to be removed from the linked list by patching the pointer that led to O to lead to O->next instead. There are two cases: for the first object in the list, you need to patch vm->firstObject; for the rest, you need to patch prevObject->next. You can unify these cases by storing a pointer to the pointer you need to patch, ie. a pointer to the pointer that led to O.
See also https://stackoverflow.com/questions/12914917/using-pointers-to-remove-item-from-singly-linked-list https://stackoverflow.com/questions/12914917/using-pointers-....