char names[][2] = {"abcdefg", "hijklmn", "qrstuv"};
printf("%c\n",*(*(names+0)+0));
printf("%s\n",names);
The last line in this code prints abhiqr
. However, changing the "2" will make the program print n characters from each array string (ie, abchijqrs
).
Why does this happen?
Also, on the middle line, I don't understand why I have a theory: I need two indirection operations because names is really a pointer to other pointers (the array) and the first dereference leaves me STILL with a pointer?
What resources can I use to read about C pointers in great detail?