[英]C lang Syntax Error missing ";" before "*"
The error appears in the List* next
line.错误出现在List* next
行。
typedef struct {
List* next;
int data;
int index;
} List;
As noted in comments, the type List
is not known when you use it.如评论中所述,使用List
时类型未知。 There are two solutions to this.有两种解决方案。
The first is to simply use struct List *next
:第一个是简单地使用struct List *next
:
typedef struct List {
int n;
struct List *next;
} List;
The other is to typedef List
into existence before defining struct List
.另一种是在定义struct List
之前typedef List
存在。
typedef struct List List;
struct List {
int n;
List *next;
};
Which is better is opinion, and thus inappropriate for SO.哪个更好的是意见,因此不适合 SO。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.