Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
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) ;
18th Nov 2019, 12:55 PM
Bahhaⵣ
Bahhaⵣ - avatar