Please highlight the difference between the following function declarations:
void (*p) (void *a[], int n)
void *(*p[]) (void *a, int n)
void (*p) (void *a[], int n) defines a pointer to a function that takes a void* array and an int as parameter
void *(*p[]) (void *a, int n) defines an array of pointers to functions that return a void*, and take a void* and an int as parameter.
Neither are function declarations, so there's nothing to explain.
Both are, however, declarations of function pointers. There is an excellent tutorial website that you should consume.
I should also suggest the handy program cdecl (or its online incarnations); perhaps you'd like to give it a shot yourself before someone reveals the answer for you?
(You need to type void *(*p[]) (void *, int) into the website; i.e. no identifiers for the function arguments.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With