我想在一个struct中有两个数组,它们在start时初始化但需要进一步编辑.我需要三个结构实例,以便我可以索引到一个特定的结构并按我的意愿修改.可能吗?
这是我认为我可以做但我得到错误:
struct potNumber{
int array[20] = {[0 ... 19] = 10};
char *theName[] = {"Half-and-Half", "Almond", "Rasberry", "Vanilla", …};
} aPot[3];
Run Code Online (Sandbox Code Playgroud)
然后我按如下方式访问结构:
printf("some statement %s", aPot[0].array[0]);
aPot[0].theName[3];
…
Run Code Online (Sandbox Code Playgroud)