If I write:
char string[] = "some string";
char **ptr = &string;
printf("%s\n",*ptr);
It prints nothing and gives a warning: warning: initialization from incompatible pointer type [enabled by default]
Now, if I write the following:
char *string = "another string";
char **ptr = &string;
printf("%s\n",*ptr);
It works all right.
Shouldn't string[] decay to a pointer similar to *string and work? Why doesn't it?
stringischar[], which will decay tochar *, notchar **.