Say you have an ad
int foo[42];
Part of the declarator foo[42] . Whenever something monotonous appears in an expression (or extension) (ie foo , followed by [ , followed by an expression, followed by ] ), the type of this subexpression will be declared as int .
In other words: as far as the syntax goes, type declaration
int *bar;
does not declare bar as int * , but instead declares *foo as int .
For a more active example, take a declaration
float (*op[42])(float, float);
In an expression, an operand of the same form might look like this:
c = (*op[i])(a, b);
According to the quote, the right side would be of type float .
It follows that
*op[i]
must have a function type (we ignore the fact that function constructors break down into corresponding types of pointers and calling a function via postfix () actually works with pointers, not pointers).
This, in turn, means that
op[i]
should indicate a pointer to a function and finally come to
op
denoting an array of function pointers, like that we can apply postfix [] on and return the correct type.
Fun, right?)
source share