incrementing an array of pointers in C

后端 未结 5 1934
滥情空心
滥情空心 2020-12-20 20:01

this is probably an essentially trivial thing, but it somewhat escapes me, thus far..

char * a3[2];
a3[0] = \"abc\";
a3[1] = \"def\";
char ** p;

5条回答
  •  时光说笑
    2020-12-20 20:30

    a3 is a name of an array. This about it as a constant pointer.

    You cannot change it. You could use a3 + 1 instead of ++a3.

    Another problem is with the use of "%s" for the *(++a3) argument. Since a3 is an array of char, *a3 is a character and the appropriate format specifier should be %c.

提交回复
热议问题