#include <stdio.h>
typedef struct
{
char ID[16];
char name[16];
char sex;
double score;
} STU;
int main()
{
STU stu[4] = {{"2010001", "呵呵", 'M', 98},
{"2010002", "呵呵da", 'M', 93},
{"2010003", "呵呵sa", 'M', 92},
{"2010004", "呵呵la", 'M', 91}};//注意此处的分号
STU *p;
for (p = stu; p < stu + 4; p++)
{
printf("%s %s %c %.lf\n", p->ID, p->name, p->sex, p->score);
/* code */
}
return 0;
}
《c语言程序设计》习题.利用指针访问结构数组
最新推荐文章于 2023-06-07 16:21:40 发布