C结构体初始化问题
main(){
struct stu
{
int num;
char *name;
char *sex;
float score;
}boy[5]={{101,"Li ping","M",45},
{102,"Zhang ping","M",62.5},
{103,"He fang","F",92.5},
{104,"Cheng ling","F",87},
{105,"Wan ming","M",58}};
int i;
for(i=1;i<=5;i++)
printf("%5d%5s%5s%5f\n",boy[i].num,boy[i].name,boy[i].sex,boy[i].score);
getch();
}
结果最后一行的显示怎么是乱码呀?还有显示时怎么让它空格啊就是这里怎么改啊printf("%5d%5s%5s%5f\n"
thank you!