【问题标题】:I am unable to understand what is the statement struct node *a [26] used for.. after we make the structure of a node for linked list我无法理解语句 struct node *a [26] used for.. after we make the structure of a node for linked list
【发布时间】:2023-01-05 20:53:05
【问题描述】:
struct node{
     int data;
     struct node*next;
};
struct node * a[26];

我们是在制作节点指针数组还是为节点指针分配大小? 请帮助我解决这个问题。

【问题讨论】:

    标签: c


    【解决方案1】:

    struct node * a[26];a 声明为一个包含 26 个指向 struct node 的指针的数组。

    【讨论】:

      【解决方案2】:

      本声明

      struct node * a[26];
      

      声明一个名为a 的数组,其中26 元素的指针类型为struct node *

      这两个声明

      struct node{
           int data;
           struct node*next;
      };
      struct node * a[26];
      

      也可以通过以下方式重写为一个声明

      struct node{
           int data;
           struct node*next;
      } * a[26];
      

      【讨论】:

        猜你喜欢
        • 2022-12-02
        • 1970-01-01
        • 2022-12-02
        • 1970-01-01
        • 2022-01-27
        • 2022-12-02
        • 2022-12-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多