+14

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

Explain with example.

11/18/2019 11:23:14 AM

ROHIT KANOJIYA

1 Answer

New Answer

+2

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) ;