#include #include void function0(void) { printf("function 0\n"); } void function1(void) { printf("function 1\n"); } void function2(void) { printf("function 2\n"); } typedef void (*VoidToVoid)(void); int main(int argc, char *argv[]) { VoidToVoid functions[3] = {function0, function1, function2}; if (argc != 2) { printf("one argument only\n"); return EXIT_FAILURE; } unsigned char index = strtol(argv[1], NULL, 10); if (index > 2) { printf("argument must be between 0 and 2\n"); return EXIT_FAILURE; } functions[index](); return EXIT_SUCCESS; }