[求助]结构体的用法
struct student
{
int num;
char name[20];
char sex;
int age;
};
struct student stu[3]={{101,"AA",'M',19},{102,"BB",'M',20},{103,"CC",'F',21}};
struct *p;
p=(struct student *)stu[0].name; /*这一步是不是把stru[0].name转换为结构体指针型,然后赋给P?*/
我想输出:
AA M 19
BB M 20
CC M 21
请问该怎样做?