Dynamic array of function pointers

To put it simply, I want to change the following,
void (*function[8])();
to
void (*(*players_ptr))();
and dynamically allocate an array of function pointers.
There are extra parentheses in there:
void (**players_ptr)()=new void (*)()[8]
Last edited on
'new' : cannot allocate 'void' objects
How about

1
2
3
typedef void (*FuncPtr)();

FuncPtr* funcPtrs = new FuncPtr[ 8 ];

Yeah, that seems like the simplest way. I also got it to work like this:
void (**players_ptr)()=(void (**)())malloc(sizeof(void *)*8);
Last edited on
Thanks guys, worked great.
Topic archived. No new replies allowed.