I am trying to create an array of strings in C. If I use this code:
(我试图在C中创建一个字符串数组。如果我使用此代码:)
char (*a[2])[14];
a[0]="blah";
a[1]="hmm";
gcc gives me "warning: assignment from incompatible pointer type".
(gcc给我“警告:从不兼容的指针类型分配”。)
What is the correct way to do this?(这样做的正确方法是什么?)
edit: I am curious why this should give a compiler warning since if I do printf(a[1]);
(编辑:我很好奇为什么这应该给编译器警告,因为如果我做printf(a[1]);
)
(,它正确打印“嗯”。)
ask by translate from so