fork download
  1. #include <stdio.h>
  2.  
  3. int add(int x, int y) { return x + y; }
  4. int sub(int x, int y) { return x - y; }
  5.  
  6. int main()
  7. {
  8. int (*func_ptr)(int, int);
  9.  
  10. func_ptr = add;
  11. printf("%d\n", func_ptr(10, 20));
  12.  
  13. func_ptr = sub;
  14. printf("%d\n", func_ptr(10, 20));
  15.  
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.02s 1720KB
stdin
Standard input is empty
stdout
30
-10