帮忙看一下这段代码!wo是菜鸟
#include"stdio.h"struct student
{
int num;
char *name;/*为什么这里要定义为指针变量呢?*/
char sex;/*为什么这里又不用呢?*/
float score;
}stu[5]={
{101,"haohaidong",'m',78},
{102,"yao ming",'m',82.5},
{103,"wangzhizhi",'m',76.5},
{104,"dengyaping",'f',87},
{105,"zhangyining",'f',46},
};
main()
{
struct student*ps;
printf("no\tname\t\t\tsex\tscore\t\n");
for(ps=stu;ps<stu+5;ps++)
printf("%d\t%s\t\t%c\t%f\t\n",ps->num,ps->name,ps->sex,ps->score);
getch();
}
刚看到“指向结构体数组的指针变量”,上面是用指针变量输出结构体数组,问题在注释中!