Passing a value to functions held in an array of functions

But in that case they wouldn't belong in the same array, would they?

It might make sense to bind arguments to some function, i.e. creating a closure and eliminating some parameters by replacing them with a fixed value before adding the function to the array, but having functions with different signatures in the same array feels wrong, and cannot be type-checked at compile time.

Edit: for the sake of readability, you could use:

using my_func_t = void (*)(int); // pointer to function from int → void
my_func_t functions[] = {func0, func1};
1 Like