fork download
  1. #include <iostream>
  2.  
  3. typedef int (*fxp)(int);
  4.  
  5. int foo(int i) {
  6. std::cout << "foo " << i << std::endl;
  7. }
  8.  
  9. int bar(int i) {
  10. std::cout << "bar " << i << std::endl;
  11. }
  12.  
  13. int main() {
  14. fxp f = foo;
  15. f(2);
  16. f(3);
  17. f = bar;
  18. f(2);
  19. f(3);
  20. }
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
foo 2
foo 3
bar 2
bar 3