节点为指针 [英] Nodes as a pointer

查看:210
本文介绍了节点为指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么链表节点被声明为指针?节点包含指针部分它链接到另一个节点。那么为什么节点本身的指针?

Why the nodes in a linked list are declared as pointers? Nodes contains the pointer part in it to link to another node. Then why the nodes are itself a pointer?

struct node
{
    int data;
    struct node *link;
} *start;

现在我们介绍节点作为

struct node *tmp;

现在,这是它是一个指针,数据类型结构node..but用于连接的节点,我们使用链接指针到其他节点链接
为什么我们dindnt codeD节点

Now this is a node which is a pointer to data type struct node..but for linking we use the link pointer to link the other node Why dindnt we coded node as

struct node tmp;

只有...这是因为动态分配memory..or更多的东西吗?

only...is this because of allocating dynamic memory..or something more?

推荐答案

是的,这是因为节点动态分配。

Yes, this is because the nodes are allocated dynamically.

这篇关于节点为指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆