【发布时间】:2019-10-03 13:24:25
【问题描述】:
我对这些声明的行有点困惑。我想为我的程序创建一个链接列表,但由于某种原因,当我尝试编译它时它一直出错。基本上这将是我的主要节点模型,并且我的列表后面还有另一个结构(没有 TYPEDEF)。编译得很好。我不知道怎么了。
我已经尝试将 typedef 放在 struct student 上。
typedef struct
{
char name[50];
int id;
node next;
}student;
typedef student* node;
typedef struct listR* list;
struct listR
{
node head,tail;
int size;
};
错误: 未知类型名称“节点” 警告: 初始化从整数生成指针而不进行强制转换
【问题讨论】:
-
在哪一行报告了“未知类型名称
node”?可能是student中的行在定义之前使用了node? -
观察listR和student的区别,在struct listR上我没有任何错误
-
在第 14 行是下一个节点!
标签: c data-structures struct linked-list typedef