c - 当指针出现在变量(指针*)的末尾时,这意味着什么?

标签 c pointers syntax structure

我已经了解了指针,但是当指针出现在像这样的变量末尾时,这意味着什么。

struct student_record_node 
{
  struct class_record* record_;
  struct class_record_node* next_;
};

最佳答案

这不是变量的结尾student_record_node 是用户定义的数据类型,使用结构说明符 struct 关键字指定。

引自wikipedia article对此,(强调我的)

A struct in the C programming language (and many derivatives) is a complex data type declaration that defines a physically grouped list of variables to be placed under one name in a block of memory, allowing the different variables to be accessed via a single pointer, or the struct declared name which returns the same address.

在你的情况下,

struct student_record_node 
{
  struct class_record* record_;
  struct class_record_node* next_;
};

是用户定义类型struct student_record_node 的声明,您可以通过以下语句创建该类型的变量

struct student_record_node stu_record;  //stu_record is the variable name

关于c - 当指针出现在变量(指针*)的末尾时,这意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40582146/

相关文章:

c++ - 尝试将派生类对象地址分配给基类指针 vector

编译linux内核模块show_mem例程

c - 为什么在 malloc 调用中引用 undefined object 有效?

c - 有没有办法让 chdir() 进入一个只知道目录名开头的目录?

c - c 指针段错误

c - 双向链表指针混淆

php - 最优化的 MySQL 语法

c# - IEnumerable with Yield 语句

javascript - ${...} 语法在 Angular 中意味着什么?大括号前面的货币符号?

c - 使用结构指针作为参数对函数进行原型(prototype)设计