I am trying to write a mapping function that takes a pointer to a function and passes it to another function, but gcc yells at me.
Here is the idea of what I'm trying to do.
void map(T thing, void apply(int a, int b, void *cl), void *cl);
void function(T thing, void apply(int a, int b, void *cl), void * cl)
{
for(int i = 0; i < 10; i++)
{
map(thing, apply, cl);
}
}
gcc complaint:
warning: passing argument 2 of 'map' from an incompatible pointer type
Any ideas?
source
share