Can we make an Array which Contain the Address of Functions.

Explain with example.

1 Answer

New Answer


yes you can, just create an array of pointers to some functions. ex: //two functions int addition(int x, int y) ; int square(int x, int y) ; //array of pointers to functions int (*pointer_array[2]) (int x, int y) ; //add function pointers to array pointer_array[0] = addition ; pointer_array[1]= square ; //call functions (addition) using array res = (*pointer_array[0]) (num1, num2) ;