em12 em12 - 4 months ago 9
C Question

Different uses of pointers in C

I know * indicates it is a pointer, but what's the difference between

int (* a)[2]
and
(int (*)[2]) a
in
C
?

Answer

int (* a)[2]; declares a as a pointer to an array of two int while (int (*)[2]) a casts a to a pointer to an array of two int.