fork download
  1. #include <iostream>
  2.  
  3. typedef void (*pFunc)(int);
  4.  
  5. void my_function(int v)
  6. {
  7. std::cout << "value = " << v << std::endl;
  8. }
  9.  
  10. void func(pFunc f, int v)
  11. {
  12. f(v);
  13. }
  14.  
  15. int main()
  16. {
  17. pFunc myFunc = &my_function;
  18. func(myFunc, 5);
  19. return 0;
  20. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
value = 5