标题:C结构体初始化问题
取消只看楼主
lifeng2007
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-4-27
 问题点数:0 回复次数:0 
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!
搜索更多相关主题的帖子: 结构体 score char name stu 
2007-07-10 17:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-154406-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.730606 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved