C:我不知道这是什么意思"while(temp->next->next)"



我有一个这样的结构链接列表

typedef struct linkedList l_List;
struct linkedList{
hash_It* item;     /*this is hashItem structure include key and value*/
l_List* next;     /*next list                                       */  
};

我的问题是:temp->next->next是什么意思?
我怀疑临时数据类型是l_List*而不是l_List**
为什么它可以通过这种方式用作 2 级指针?

cre:我在另一个来源上找到了这段代码

l_List* temp = list;
while (temp->next->next) {
temp = temp->next;
}

它等价于

l_List* find(l_list *temp)
{
while (temp->next) 
{
l_list *temp1 = temp -> next;
if(temp1 -> next == NULL)
break; 
temp = temp->next;
}
return  temp;
}

它应该可以帮助您理解它的含义。

l_list *temp1 = temp -> next -> next;

l_list *temp1 = temp -> next;
temp1 = temp1 -> next;

最新更新