fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. typedef void (*func)();
  5.  
  6. void function1() {
  7. cout << "func1" << endl;
  8. }
  9.  
  10. void function2() {
  11. cout << "func2" << endl;
  12. }
  13.  
  14. void function3() {
  15. cout << "func3" << endl;
  16. }
  17.  
  18. int main() {
  19. func arr[3] = {&function1, &function2, &function3};
  20. for(int i = 1; i <= 3; ++i)
  21. arr[i-1]();
  22. return 0;
  23. }
Success #stdin #stdout 0s 4392KB
stdin
Standard input is empty
stdout
func1
func2
func3