What if i want to have an array of pointers to a function and the size of the array is not known from the beginning? I’m just curious if there’s a way to do that. Using new statement or maybe something else. Something looking similar to
void (* testArray[5])(void *) = new void ()(void *);
You could use a
std::vector:If you really want to use a static array, it would be better to do it using the
FunPointeri defined in the snippet above:Though i would still go for the vector solution, taking into account that you don’t know the size of the array during compilation time and that you are using C++ and not C.