fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. bool SomeFunc(int a)
  5. {
  6. return a > 0;
  7. }
  8.  
  9. int main()
  10. {
  11. typedef bool(*MyFunctionPointer)(int);
  12. MyFunctionPointer foo = SomeFunc;
  13.  
  14. std::string result = foo(0) ? "Yay" : "Nay";
  15. std::cout << result << std::endl;
  16.  
  17. using MyBetterFunctionPointer = bool(*)(int);
  18. MyBetterFunctionPointer bar = SomeFunc;
  19.  
  20. result = bar(1) ? "Yay" : "Nay";
  21. std::cout << result << std::endl;
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Nay
Yay