加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 难以理解链表实现(结构部分)?

发布时间:2020-12-16 10:06:35 所属栏目:百科 来源:网络整理
导读:struct node{ int data; struct node *next;}*start; 我不明白接下来做什么结构节点,我知道它指向下一个变量的地址;但是如何实施? node * next接下来类似于struct node *吗? 那么* start是什么类似于struct node * start? 我发现很难理解链接列表的实现.
struct node
{ 
    int data;
    struct node *next;
}*start;

我不明白接下来做什么结构节点,我知道它指向下一个变量的地址;但是如何实施? node * next接下来类似于struct node *吗?

那么* start是什么类似于struct node * start?

我发现很难理解链接列表的实现.

解决方法

I don’t understand what struct node *next does,I know it points to the address of the next variable; …

这是对的.

… but how as in implementation ?

实现几乎就是您描述行为的方式:指针实现为一个对象,其值是指向对象的内存地址.

Is node *next similar to struct node *next?

不仅相似,而且非常相同.?

And what about the *start is it similar to struct node *start?

它是struct node * start.查看完整声明:

struct node /* structure definition */ *start;

它是变量的组合声明和结构的定义.

?struct关键字仅用于消除以下标识符在结构标记的名称空间??中的歧义.在您的情况下,它是多余的,因为没有非结构标识符Node可以消除歧义,而在C结构中,标签也是类型名称.

您可能正在查看的是C代码,其中名称空间??说明符对于结构标记是必需的.

??在这个上下文中,我指的是C名称空格,而不是C名称空格.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读