fork download
  1. #include <stdio.h>
  2.  
  3. //------------------------------------
  4.  
  5. void f1() { puts("I'm f1."); }
  6. int f2(int a, int b) { return a + b; }
  7. char f3() { return 'a'; }
  8.  
  9. //------------------------------------
  10.  
  11. int main() {
  12. void *fun_array[3] = { &f1, &f2, &f3 };
  13. ((void (*)())fun_array[0])();
  14. printf("%i\n", ((int (*)(int, int))fun_array[1])(3, 5));
  15. printf("%c\n", ((char (*)())fun_array[2])());
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 2160KB
stdin
Standard input is empty
stdout
I'm f1.
8
a