1 #include "stdio.h" 2 void main() 3 { 4 int i; 5 struct student { 6 int age; 7 char *name; 8 char *sex; 9 char *hobby; 10 }; 11 struct student ta[] = { 12 18,"学生1","男","篮球", 13 19,"学生2","女","看书", 14 18,"学生3","男","学习单片机", 15 17,"学生4","女","航模" 16 }; 17 for(i=0;i<4;i++) 18 { 19 printf("%s ",ta[i].name); 20 printf("%d ",ta[i].age); 21 printf("%s ",ta[i].sex); 22 printf("%s ",ta[i].hobby); 23 } 24 }