#include<stdio.h> #include<stdlib.h> struct stu { int id; int age; char name[128]; }; int main (void) { //结构体数组: 数组中的每一个元素都是结构体 struct stu num[5] = {{1,2,"shun1"},{11,22,"shun2"},{111,222,"shun3"},{13,23,"shun4"},{12,45,"shun5"}}; for (int i = 0; i < sizeof(num)/sizeof(num[0]);i++ ) { printf("%d , %d , %s \n",num[i].age, num[i].id, num[i].name); } return 0; }
2 , 1 , shun1
22 , 11 , shun2
222 , 111 , shun3
23 , 13 , shun4
45 , 12 , shun5
标签:--,C语言,int,num,111,数组,sizeof,id From: https://www.cnblogs.com/shunguo/p/16840011.html