我试图通过阅读一些代码并理解它来理解单向链表。这段代码,在这个网站http://www.sanfoundry.com/cpp-program-implement-single-linked-list/上 找到,有
struct node
{
int info;
struct node *next;
} *start;
Run Code Online (Sandbox Code Playgroud)
我理解 int info 和 struct node *next 的作用,但是关闭括号后额外的 *start 是什么意思?
谢谢!
start是一个类型的变量struct node*- 我猜它是列表的头部。
如果您发现拆分类型和变量更容易:
struct node
{
int info;
struct node *next;
};
struct node* start;
Run Code Online (Sandbox Code Playgroud)
由于这是 C++,因此您也可以简化为 node* start;