fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void add(int a, int b){
  5. cout << a+b << endl;
  6. };
  7.  
  8. void subtract(int a, int b){
  9. cout << a-b << endl;
  10. };
  11.  
  12. void multiply(int a, int b){
  13. cout << a*b << endl;
  14. };
  15.  
  16. int main(){
  17.  
  18. void (*operations[3])(int, int) = {add, subtract, multiply};
  19.  
  20. int length = sizeof(operations)/sizeof(operations[0]);
  21.  
  22. for(int i=0; i<length;++i){
  23. cout << (void*)operations[i] << endl;
  24. }
  25.  
  26. }
  27.  
Success #stdin #stdout 0s 4184KB
stdin
Standard input is empty
stdout
0x55a82061f3f0
0x55a82061f2f0
0x55a82061f370