在定义结构体后,需要通过结构体名来创建实例。例如,对于以下结构体定义:
struct Student { int id; char name[20]; };
可以通过以下方式来创建结构体实例:
struct Student stu1;
而不是使用以下方式:
Student stu1;
因为编译器无法识别后一种方式,会报错'error: ‘Student’ does not name a type”。
上一篇:编译器不想执行代码块。
下一篇:编译器不支持API版本32,请使用API版本30或更早的版本