What is the difference between these two function pointer notations in C?
void (*a[]()) and void (*a)()[]
Do they both represent same – a as an array of pointers to functions – or does the second one represent a pointer to an array of functions?
How should I call these functions –
say void (*a[]()) = {swap, add, sub, prod};?
Does that mean that a is an array of function pointers of 4 elements and swap, add, sub, prod‘s address are there in the a[0]…a[3].
How should I invoke these functions, like this?
*a[i]()
or like this?
a[i]()
Use cdecl.org to figure this stuff out until you can do it without thinking about it.
void (*a[]()): declare a as array of function returning pointer to voidwhereas
void (*a)()[]: declare a as pointer to function returning array of voidThe latter is invalid C.