fork(1) download
  1. #include <iostream>
  2.  
  3. typedef void (*someFunction)(int, char*);
  4.  
  5. void FirstsomeFunction(int i, char *c)
  6. {
  7. std::cout<<"\n In FirstsomeFunction";
  8. }
  9.  
  10. void SecondsomeFunction(int i, char *c)
  11. {
  12. std::cout<<"\n In SecondsomeFunction";
  13. }
  14.  
  15. int main()
  16. {
  17. someFunction arr[1];
  18. int x = 0;
  19. std::cin >> x;
  20.  
  21. if(x ==0)
  22. arr[0] = &FirstsomeFunction;
  23. else
  24. arr[0] = &SecondsomeFunction;
  25.  
  26. (arr[0])(10,"Hello");
  27.  
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 2900KB
stdin
1
stdout
 In SecondsomeFunction