C variable declaration

What's the difference between

char *a[10];

and

char *(a[10]); 

I always used the first for an array of char pointers, but now I found code that used the second.
Since I was not sure if this is the same, I printed sizeof () and both return 80 (64-bit OS), so I tend to assume that both of them are the same (array of char pointers).

But since I cannot find any explanation on the Internet or anything using the syntax * ([]), I was looking for confirmation.

thank

+5
source share
2 answers

Both are equivalent and represent a 10-element array of pointers to char.

Contrast with char (*a)[10], which is a pointer to a 10 element array char.

, cdecl, C. Unix . -.

+11

char *a[10]; char *(a[10]); . , : char *a[10]; pointer array 10, 10, all are pointers! , .

+1

All Articles