I need to be passed by argv[]
, in the main function, the name of a function that will be called by it.
I can not make comparisons of strings , so I should make the call with variables.
Here is my code:
typedef void (*func)(void);
void A (void){ printf("*funcao A*\n"); }
void B (void){ printf("*funcao B*\n"); }
void fun(func fc){
fc();
}
int main(int argc, char *argv[]){
int i;
for(i = 1; i < argc; i++){
fun(argv[i]);
}
system("PAUSE");
return 0;
}
In this way the algorithm compiles but does not execute.