After having seen (and asked!) so many questions similar to
What does
int (*f)(int (*a)[5])
mean in C?
and even seeing that they'd made a program to help people understand the C syntax, I can't help but wonder:
Why was the syntax of C designed this way?
For example, if I were designing pointers, I would translate "a pointer to a 10-element array of pointers" into
int*[10]* p;
and not
int* (*p)[10];
which I feel most people would agree is much less straightforward.
So I'm wondering, why the, uh, unintuitive syntax? Was there a specific problem the syntax solves (perhaps an ambiguity?) that I'm unaware of?
cdecl
command is very handy for decoding complex C declarations. There's also a web interface at cdecl.org.