c指向结构体数组的指针
struct student{
int num;
char name[20];
char sex;
int age;
};
struct student stu[3]={{99001,"li lin",'m',18},{99002,"zhang fan",'M',19},{99003,"wang min",'F',20}};
main()
{
struct student*p;
printf("NO. Name sex age\n");
for(p=stu;p<stu+3;p++)
printf("%5d%-20s%2c%4d\n",p->num,p->name,p->sex,p->age);
}这样的程序运行不到想要的结果,99001 99002 99003显示不出来,在前面加long int num也不行,怎么样做才能得到这些长编号。谁能帮我理解这些问题,谢谢!
[ 本帖最后由 hdshdzh 于 2010-5-20 08:29 编辑 ]