Mine
public text v1 · immutabletypedef struct funktio {
char *nimi;
void (*ptr)();
};
funktio funktiot[] {
{"getA", &getA},
{"getB", &getB),
{NULL, NULL}
}
void (*haeFunktio(const char *nimi))()
{
int i;
while (funktiot[i].nimi != 0) {
if (!strcmp(funktiot[i].nimi, nimi))
return funktiot[i].ptr;
i++;
}
return NULL;
}