|
|
#include void A(void){ void B(void){ void C(void){ void(*ArrFunc[3])(void) ={A,B,C}; while(1){ if((func_number > 0) && (func_number < 4)){
E-mail:
info@telesys.ru
printf("A\n");
}
printf("B\n");
}
printf("C\n");
}
void main()
{
int func_number;
void(*fp)(void); /* fp is a pointer to a function */
printf("\nSelect a function 1-3 :");
scanf("%d", &func_number);
fp = ArrFunc[func_number-1]; /* assign the function address to fp */
(*fp)(); /* and call the selected function */
}
}
}
Ответы