更新时间:2022-06-27 00:50:10
在开始的时候,你做
pp = &list_head;
和,你遍历列表,推进这一指针以
and, as you traverse the list, you advance this "cursor" with
pp = &(*pp)->next;
这样,你永远保持这里的你是从哪里来的,可以修改指针生活在那里的点的轨迹。
This way, you always keep track of the point where "you come from" and can modify the pointer living there.
所以,当你发现条目被删除,你可以做
So when you find the entry to be deleted, you can just do
* PP =入门>接下来
这样,你采取的三种情况下护理的 AFAQ 的提到了另一个答案,有效地消除了 NULL
检查 $ p $光伏
。
This way, you take care of all 3 cases Afaq mentions in another answer, effectively eliminating the NULL
check on prev
.