merlin100 said:
Ok I have an array of pointers to functions that return int and take
void like:
int (*funcsP[])(void) = {func_a, func_b};
Now I want to create a pointer to that array and I can't figure out
the correct "incantation"
Any help would be appreciated.
Are you sure you want a pointer to the array? Usually it's more useful
to have a pointer to an element of the array; by incrementing that
pointer, you can step through the array.
For a pointer to the entire array:
int (*(*arr_ptr)[2])(void) = &funcsP;
For a pointer to an element of the array:
int (*(*elem_ptr))(void) = funcsP;
The "cdecl" command is very useful for this kind of thing:
% cdecl
Type `help' or `?' for help
cdecl> explain int (*funcsP[])(void)
declare funcsP as array of pointer to function (void) returning int
cdecl> declare arr_ptr as pointer to array of pointer to function (void) returning int
Warning: Unsupported in C -- 'Pointer to array of unspecified dimension'
(maybe you mean "pointer to object")
int (*(*arr_ptr)[])(void )
cdecl> declare arr_ptr as pointer to array 2 of pointer to function (void) returning int
int (*(*arr_ptr)[2])(void )
cdecl> declare elem_ptr as pointer to pointer to function (void) returning int
int (**elem_ptr)(void )
cdecl>