Page 150 - C-Language
P. 150
lists in prototype form. If you see [3], that's read as "array (size 3) of...". If you see (char *,int)
that's read as *"function expecting (char ,int) and returning...".
Here's a fun one:
int (*(*fun_one)(char *,double))[9][20];
I won't go through each of the steps to decipher this one.
*"fun_one is pointer to function expecting (char ,double) and returning pointer to array (size 9) of
array (size 20) of int."
As you can see, it's not as complicated if you get rid of the array sizes and argument lists:
int (*(*fun_one)())[][];
You can decipher it that way, and then put in the array sizes and argument lists later.
Some final words:
It is quite possible to make illegal declarations using this rule, so some knowledge of what's legal
in C is necessary. For instance, if the above had been:
int *((*fun_one)())[][];
it would have read "fun_one is pointer to function returning array of array of pointer to int". Since a
function cannot return an array, but only a pointer to an array, that declaration is illegal.
Illegal combinations include:
[]() - cannot have an array of functions
()() - cannot have a function that returns a function
()[] - cannot have a function that returns an array
In all the above cases, you would need a set of parentheses to bind a * symbol on the left
between these () and [] right-side symbols in order for the declaration to be legal.
Here are some more examples:
Legal
int i; an int
int *p; an int pointer (ptr to an int)
int a[]; an array of ints
int f(); a function returning an int
int **pp; a pointer to an int pointer (ptr to a ptr to an int)
int (*pa)[]; a pointer to an array of ints
int (*pf)(); a pointer to a function returning an int
int *ap[]; an array of int pointers (array of ptrs to ints)
https://riptutorial.com/ 126

