以下是结构什么呢节点=节点 - >未来意味着链表(数据结构)
struct list *node
{
int data;
struct list *next;
}
什么节点=节点 - >下一步究竟做遍历该链表,而不是指向节点变量中指针的下一个元素指针?
以下是结构什么呢节点=节点 - >未来意味着链表(数据结构)
struct list *node
{
int data;
struct list *next;
}
什么节点=节点 - >下一步究竟做遍历该链表,而不是指向节点变量中指针的下一个元素指针?
node = node-> next使节点指向链表中的下一个指针。 由于下一个存储的值是指向列表中下一个元素的指针。 因此,将节点作为node-> next,然后再次调用该函数或在for循环中迭代使您前进。 希望有帮助
想象一下用while
循环递增一个变量。
int i = 0;
while (i < 6) {
// this loop will run forever without the line below
i++; // adds one to i so the loop will not run infinitely
}
的概念是与链表一样:
while (node != NULL) {
//need to make sure this loop doesn't run forever
node = node->next // kind of like incrementing i
}
现在while循环运行,直到到达列表的末尾。