fork download
  1. #include <map>
  2. #include <iostream>
  3.  
  4. void testFunc()
  5. {
  6. std::cout<<"It works!\n";
  7. }
  8.  
  9. int main()
  10. {
  11. std::map<int, void (*)()> mymap;
  12. mymap[1]=testFunc ;
  13.  
  14. void (*final)() = mymap[1];
  15. final();
  16. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
It works!