定义结构体数组并初始化结构体成员
#include <stdio.h>
struct stud{
int num;
char *name;
char sex;
float score;
}boy[3]={
{101,"Li Ping",'M',45},
{102,"Zhang Ping",'M',62.5},
{103,"He fang",'F',92.5}
};
void main(){
for (int i=0;i<3;i++)
{
printf("%d %s %c %.2f
",boy[i].num,boy[i].name,boy[i].sex,boy[i].score );
}
}