[练习9-4]定义一个包含5名学生信息的数据结构,并对该数组的所有元素进行初始化。
#include <stdio.h> struct student{ int num; char name[40]; int computer, english, math; }; int main(void){ int i; struct student students[5] = { {1,"Bob",66,77,88}, {2,"Alix",76,77,88}, {3,"Tom",66,97,58}, {4,"Mon",66,77,88}, {5,"Tli",63,87,48}, }; for (i = 0; i < 5; i++) { printf("%d \t %5s \t \n",students[i].num, students[i].name); } return 0; }