How would I declare a as a array of 4 pointers to functions with no parameters and which return void? The pointers originally point to functions with names: insert, search, update, and print.
This is the closest I can get to the declaration:
void (*a[4]) () {insert,search,update,print}
It's so much more readable using a typedef when dealing with function pointers.
typedef void (*MyFuncPtr)( void );
MyFuncPtr a[] = { insert, search, update, print };
Note that no arguments is denoted using (void), not ().
Note that while [4] is ok, [] is sufficient here.
Without, it would be
void (*a[])( void ) = { insert, search, update, print };
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