我有一个类似的结构linkedList
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;