int (*rdPtrList[4])(unsigned int addr, unsigned int data);
The above declares an array of size 4 of pointers for functions that returns an int and takes two unsigned int. I would like to make a pointer to this array. Is this possible in C?
Ah, tricky tricky!!!
I think this works
int (*(*rdPtrList)[4])(unsigned int addr, unsigned int data);
because the compiler tells me _countof(*rdPtrList) is 4.
(I wish you could just say int function(unsigned int addr, unsigned int data)[4]* like you can in D, it's so much more readable: it would be a "function array pointer".)
ptr_to_fixed_length_function_array = &array_of_functions;. If the type isn't correct, your compiler should complain about this assignment.Try this:
typedef int(*rdPtrList_t[4])(unsigned int addr, unsigned int data);
rdPtrList_t *ptrToArray;