repl.it
@maniero/

SwitchAlternative.c

C

No description

fork
loading
Files
  • main.c
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>

void telaAjuda1() {
	printf("f1");
}

void telaAjuda2() {
	printf("f2");
}

int main(void) {
	int opAjuda;
    scanf("%i", &opAjuda);
    void (*opcoes[])() = {&telaAjuda1, &telaAjuda2};
    (*opcoes[opAjuda - 1])();
}

//https://pt.stackoverflow.com/q/97604/101
?