C:在名单上使用哨兵

问题描述 投票:2回答:1

您好我正在学习链表,我必须使用哨兵编写几个函数。我有这个定义:一个sentinel是一个假元素,它是列表的第一个元素。然后空列表是单个标记而不是NULL指针。

我需要初始化一个空列表的标记

void list_init(struct list *list);

并检查列表是否为空(返回true为空)

int list_is_empty(struct list *list);

但是我完全迷了,你能救我​​一下吗,谢谢!

c list sentinel
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.