array type has incomplete element type
代码:
#define MaxSize 50 │2
//定义学生的结构类型 │请输入圆柱体的底圆半径和高:10 8
struct stduent{ │该圆柱体的体积为:2512.00
int num; │1-计算圆球的体积2-计算圆柱体的体积3-计算圆椎体的体积其他-退出程序运行
char name[10]; │3
int computer, english, math;//这种定义形式 │请输入圆锥体的底圆半径和高:10 8
double average; │该圆锥体的体积为:837.33
}; │1-计算圆球的体积2-计算圆柱体的体积3-计算圆椎体的体积其他-退出程序运行
int count = 0; │^C
//新增学生 │[root@localhost example]#
void add_student(struct student students[]); │
//查询学生信息,根据学生编号 │
void search_student(struct student students[], int num); │
//输出全部学生的信息 │
void output_student(struct student students[]);
报错信息:
9-1.c:17:33: error: array type has incomplete element type
void add_student(struct student students[]);
^
9-1.c:17:25: warning: ‘struct student’ declared inside parameter list [enabled by default]
void add_student(struct student students[]);
^
9-1.c:17:25: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
9-1.c:19:36: error: array type has incomplete element type
void search_student(struct student students[], int num);
^
9-1.c:19:28: warning: ‘struct student’ declared inside parameter list [enabled by default]
void search_student(struct student students[], int num);
^
9-1.c:21:36: error: array type has incomplete element type
void output_student(struct student students[]);
^
9-1.c:21:28: warning: ‘struct student’ declared inside parameter list [enabled by default]
void output_student(struct student students[]);
原因:
定义结构时,名称写错了!!! student写成了stduent,编译报错,提示的我一愣愣的
warning: data definition has no type or storage class [enabled by default]
翻译
警告:数据定义没有类型或存储类[默认启用]
可能的原因
函数外,写赋值表达式