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;
p = a3;
this works:
printf("%p - \"%s\"\n", p, *(++p));
this does not:
printf("%p - \"%s\"\n", a3, *(++a3));
the error i'm getting at compilation is:
lvalue required as increment operand
what am i doing wrong, why and what is the solution for 'a3'?
a3 is a constant pointer, you can not increment it. "p" however is a generic pointer to the start of a3 which can be incremented.
You can't assign to a3
, nor can you increment it. The array name is a constant, it can't be changed.
c-faq
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With