struct bop
{
char fullname[50];
char title[20];
char bopname[50];
enum preference {swim = 0,basketball,snooker,game};
}members[]={
{"张三","教授","漂流瓶",1},
{"李四","讲师","秋叶",2},
{"钱二","副教授","此人不在",0},
{"王五","教授","天涯",3},
{"赵毅","后勤人员","无处不在",1}
};
错误是 too many initializers
解决办法:
enum preference {swim = 0,basketball,snooker,game};
struct bop
{
char fullname[50];
char title[20];
char bopname[50];
preference ref;
}members[]={
{"张三","教授","漂流瓶",(preference)1},
{"李四","讲师","秋叶",(preference)2},
{"钱二","副教授","此人不在",(preference)0},
{"王五","教授","天涯",(preference)3},
{"赵毅","后勤人员","无处不在",(preference)1}
};
}