C 错误行:43编译器:预期标识符或';(';之前';[';标记
我对43号线有这个问题,我不知道为什么 如果我不写那一行,错误就不会出现,我已经看过代码一段时间了,我还没有找到它出现的原因 错误就在这里C 错误行:43编译器:预期标识符或';(';之前';[';标记,c,typedef,C,Typedef,我对43号线有这个问题,我不知道为什么 如果我不写那一行,错误就不会出现,我已经看过代码一段时间了,我还没有找到它出现的原因 错误就在这里 /*for(i=0;i<MAX_ESTACIONES;i++){ Estaciones[i].nobici=10; //the problem is this line } */ /*for(i=0;i的typedef使Estaciones成为类型的名称,而不是您想要的变量: typedef struct {
/*for(i=0;i<MAX_ESTACIONES;i++){
Estaciones[i].nobici=10; //the problem is this line
}
*/
/*for(i=0;i的typedef
使Estaciones
成为类型的名称,而不是您想要的变量:
typedef struct
{
int nobici;
clock_t inicio,fin;
} Estaciones[MAX_ESTACIONES];
删除typedef
使其成为变量,或使其同时成为类型和变量:
typedef struct
{
int nobici;
clock_t inicio,fin;
} TheStructName;
TheStructName Estaciones[MAX_ESTACIONES];
删除typedef struct…Estaciones[…]
中的typedef。显然,您正试图将Estaciones
定义为一个类型并将其用作变量。此外,与使用typedef struct{…}Name;
不同,您应该真正使用struct Name{…}
现在。您正在使用哪个IDE?从第二个struct
中删除typedef
欢迎使用SO!请使用最少的测试用例。谢谢,现在我了解更多:)谢谢:),现在我了解更多
typedef struct
{
int nobici;
clock_t inicio,fin;
} TheStructName;
TheStructName Estaciones[MAX_ESTACIONES];