结构体
struct stu
{
int num;
char name[10];
char s;
int cla;
int score[3];
}student[10]={{1,"zhang",m,1,95,96,97},{...},...};
int main()
{
for(i=0;i<10;i++)
{
printf(%d %s %c %d %d %d %d",student[i].num,\
student[i].name,student[i].s,student[i].cla,student[i].score[0],\
student[i].score[1],student[i].score[2]
}
struct定义结构体关键字
stu结构体名
student结构体数组名
%s%c可以互换,后面student[i].name student[i].s也互换
赋值结构体数组要和前面定义一一对应
汉字可以输出,汉字占两个字节大小
fflush(stdin);清空缓存
后面的结构体引用前面的结构体输出两个结构体中定义的变量