I am trying to create a function:
int func(int a, int b) { if (a == b) return 1; else return 0; }
Then I would like to create a function pointer like:
int (*ptr)(int, int);
How can I assign dynamically ptr to allow for it to hold, for example, 10 different function calls?
ptr[0] = func(1, 1);
ptr[1] = func(1, 0);
...
ptr[9] = func(0, 0);
So that I can call function inside FOR loop via pointer like:
int result = 0;
for (int i = 0; i < 10; i++)
result += ptr[i];
printf ("%d\n", result);