struct abc {
int a;
char *b;
};
int main()
{
#define OFFSET 99
struct abc tst[100] = {
[OFFSET] = {1, "gliethttp"},
};
printf("%d:%s\n", tst[OFFSET].a, tst[OFFSET].b);
}
或者
[OFFSET] = {.a = 1, .b = "gliethttp"},
还有就是批量赋初始值
[0 ... ELEMENT_MAX-1] = {1, "gliethttp"}
阅读(1966) | 评论(0) | 转发(0) |