小编bul*_*eye的帖子

链接列表的结构声明

typedef struct
{
    int idno;
    char name[max];
    float cgpa;
}student;

struct node
{
    student s;
    Link  next;
};
 typedef struct node Node;
 typedef  Node  *Link;
Run Code Online (Sandbox Code Playgroud)

这不起作用,因为编译器不知道链接,但这是有效的

在函数'main'中:| 错误:未知类型名称'链接'|

typedef struct {
    int idno;
    char name[max];
    float cgpa;
}student;

typedef struct node Node;
typedef  Node  *Link;
struct node
{
    student s;
    Link  next;
};
Run Code Online (Sandbox Code Playgroud)

但是这里编译器在结构声明之前如何知道,因此可以定义它们的类型?

c

3
推荐指数
1
解决办法
3243
查看次数

标签 统计

c ×1