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?
Leaving out the parameters to keep the following easier to read:
p -- p *p -- is a pointer (*p)[4] -- to a 4-element array *(*p)[4] -- of pointers (*(*p)[4])() -- to functions int (*(*p)[4])(); -- returning int.
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".)
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