#include<stdio.h>
typedef struct {
char name[10];
int id;
}STD;
int main(int argv,char *argc[])
{
STD test = {
.name = "gong",
.id = 10
};
STD test1[3] = {
[0] = {.name = "gogn1",.id = 11,},
[1] = {
.name = "yu1",
.id = 12,
}
};
int test2[3] = {[0] = 0,[1] = 1,[2] = 2};
printf("%s,%d\n",test.name,test.id);
printf("%s,%d\n",test1[0].name,test1[0].id);
printf("%s,%d\n",test1[1].name,test1[1].id);
printf("%d,%d,%d\n",test2[0],test2[1],test2[2]);
return 0;
}
版权声明:本文为qq_45604814原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。