I’ve got these prototypes:
int *my_func(int x, void (*other_func)(int a, int b));
int func2(int val1, int val2);
Assume there is a function written that matches it.
If I want to actually call my_func, how would I do it? I’ve tried the following with no luck:
my_func(1,func2);
Here’s the error:
warning: passing argument 2 of ‘my_func’ from incompatible pointer type
That’s because the function prototypes don’t match:
is not the same as:
One takes a
void*andint*, while the other takes twoints.EDIT:
Also, the return type doesn’t match.
EDIT 2:
Since you’ve fixed both errors, this answer is out of context. I just tested it with these two fixes, and it compiles: