What is the difference between
char *array[10];
and
char (*array)[10];
?
By my understanding,
- Case 1:
array
is declared as an array of character arrays of size 10.- This is because
[]
has higher precedence than*
.
- Case 2:
array
is declared as a pointer to a character array of size 10.- This is because
()
and[]
have the same precedence and they are evaluated from left-to-right. Then the*
operator is evaluated.
Is my understanding correct? Even if it is correct, I get incredibly confused. Can someone please explain the difference a little more clearly?