#include<stdio.h>
typedef struct student
{
char name[10];
int stu_id;
int score[3];
char sex;
int age;
} STUDENT, *PSTUDENT;
STUDENT a[3]= { {"li ming", 123456, {60, 67, 80}, 'w', 10},
{"wang ming", 123457, {70, 90, 80}, 'm', 12},
{"li fei", 123458, {30, 60, 100}, 'w', 15}};
int main()
{
PSTUDENT p = (PSTUDENT)a;
int i;
for (i=0; i<3; ++i,++p)
printf("%-12s %-8d %4d %4d %4d %c %4d\n", p->name, p->stu_id, p->score[0], p->score[1], p->score[2], p->sex, p->age);
}
typedef struct student
{
char name[10];
int stu_id;
int score[3];
char sex;
int age;
} STUDENT, *PSTUDENT;
STUDENT a[3]= { {"li ming", 123456, {60, 67, 80}, 'w', 10},
{"wang ming", 123457, {70, 90, 80}, 'm', 12},
{"li fei", 123458, {30, 60, 100}, 'w', 15}};
int main()
{
PSTUDENT p = (PSTUDENT)a;
int i;
for (i=0; i<3; ++i,++p)
printf("%-12s %-8d %4d %4d %4d %c %4d\n", p->name, p->stu_id, p->score[0], p->score[1], p->score[2], p->sex, p->age);
}