C语言--键值对赋值
程序员文章站
2022-06-12 20:21:41
...
#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;
}
上一篇: Sqlserver2005附加数据库时出错解决办法
下一篇: MySQL中静态(固定长度)表特征