c - 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
意思?
我怀疑 temp 数据类型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;
推荐阅读
- c# - 什么是检查字符串变量值是否是 C# 中一组指定值之一的智能方法?
- selenium - 通过 jenkins 从 TestNg 文件运行测试
- javascript - 如何知道用户是否从 facebook 或 WhatsApp 或 PHP 中的任何其他网站重定向(或来自)
- soap - 如何在 IBMi 上运行的 Liberty 上启用 SOAP 跟踪
- javascript - 定期刷新 Django 模板中的占位符和画布标签
- sql - Oracle 空值有时符合任何规则
- javascript - 如果单击已附加的 div 之一,如何获取值?
- javascript - 从 setState 回调返回
- linux - 将 blkid 中的 UUID 添加到 /etc/fstab
- ruby-on-rails - 参数丢失或值为空:名称 - 需要输入的确切值