简单链接列表指针问题

编程入门 行业动态 更新时间:2024-10-27 11:18:14
本文介绍了简单链接列表指针问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这行代码有什么作用?

What does this line of code do?

p->next->next

这个怎么样:

what about this one:

p->next->data

如果我第一次做错了什么的,那就太好了。

SOrry if i did anything wrong 1st time.

推荐答案

p->next->next

在这种情况下我们正在遍历链表。 我们基本上是导航两个链接节点。

In this case we are traversing the linked list. We are basically navigating two link nodes.

p->next->data

这里,我们导航到下一个链表节点,然后访问其数据值。

Here, we are navigating to the next linked list node and then accessing its data value.

引用:

p-> next-> next

p->next->next

将其视为两步操作:

See it as a two-steps operation:

p->next

为您提供指向列表下一个元素的指针,然后

gives you the pointer to the next element of the list, then

(p->next)->next

为您提供指向元素的指针紧接着下一个,即指向项目'距离2'的指针。

gives you the pointer to the element immediately following the next, that is the pointer to the item 'at distance 2'.

Quote:

p-> next-> data

p->next->data

使用类似的参数,你可以写

With a similar argument, you may write

(p->next)->data

显示您正在访问数据成员列表的下一个元素。

showing you are accessing the data member of the next element of the list.

更多推荐

简单链接列表指针问题

本文发布于:2023-06-04 08:38:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/493393.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:指针   简单   链接   列表

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!