do your functions that should be called in case the button is pressed all accept different arguments?
or do the arguments (and also the return type of the functions youre calling) all match?
edit: so thats the signature i'm talking about - not sure if you're familiar with that word, so i put it that way.
edit2: so in case the signatures of all your functions are identical:
e.g.
Code:
void my_error_func(int x, int y); // function to handle invalid combinations of buttons
void my_func1(int x, float y);
void my_func2(int x, float y);
void my_func3(int x, float y);
void my_func4(int x, float y);
etc...
you could do something like:
Code:
void *my_function_pointer_array[32](int, float) = { my_func1, my_error_func, my_func2, my_error_fun, my_func3, my_func4, ... }
and when the button is clicked:
Code:
int pattern = (is_button_enabled(FIRST_BUTTON_ID) << 0) |
(is_button_enabled(SECOND_BUTTON_ID) << 1) |
... | (is_button_enabled(FIFTH_BUTTON_ID) << 4);
and invoke the appropriate function by:
Code:
my_function_pointer_array[pattern](my_first_argument, my_other_argument);