fork download
  1. #include <stdio.h>
  2.  
  3. void telaAjuda1() {
  4. printf("f1");
  5. }
  6.  
  7. void telaAjuda2() {
  8. printf("f2");
  9. }
  10.  
  11. int main(void) {
  12. int opAjuda;
  13. scanf("%i", &opAjuda);
  14. void (*opcoes[])() = {&telaAjuda1, &telaAjuda2};
  15. (*opcoes[opAjuda - 1])();
  16. }
  17.  
  18. //https://pt.stackoverflow.com/q/97604/101
Success #stdin #stdout 0s 4500KB
stdin
2
stdout
f2