这段代码来自我在学校为数据结构模块工作的任务。这个代码在问题中提供,我无法理解这一点。链接列表定义
typedef struct _listnode {
int item;
struct _listnode *next;
} ListNode; // You should not change the definition of ListNode
typedef struct _linkedlist {
int size;
ListNode *head;
} LinkedList; // You should not change the definition of LinkedList
我很困惑,因为我的演讲幻灯片和我一直在检查的网站刚刚定义了节点,而不是第二个节点。
任何人都可以帮助我吗?
所以,如果我想编写一个函数来将数据插入到列表中,我不得不创建一个使用结构ListNode新的节点? @fluter –
:@JeromePapalie是的。 LinkedList表示整个列表,ListNode表示列表中的单个项目。 – JeremyP
是的,那是ListNode的。 – fluter