#include <stdio.h>
#include <string.h>

typedef int (*fx_t)(int); /* fx_t e ponteiro para funcao que recebe e devolve int */

int fx1(int a) { return a + 1; }
int fx2(int a) { return a + 2; }
int fx3(int a) { return a + 3; }

int main(void) {
    char y[10];
    strcpy(y, "fx2"); /* obtem y do utilizador */

    fx_t x = NULL;
    if (strcmp(y, "fx1") == 0) x = fx1;
    if (strcmp(y, "fx2") == 0) x = fx2;
    if (strcmp(y, "fx3") == 0) x = fx3;
    if (x) printf("%d\n", x(42)); // chama fx1(42) ou fx2(42) ou fx3(42) */
    return 0;
}
