I’m trying to call a function that takes an argument, void(*)(void*, int, const char*), but I cannot figure out how to pass those arguments to the function.
Example:
void ptr(int);
int function(int, int, void(*)(int));
I am trying to call the function like this:
function(20, 20, ptr(20));
Is this possible?
You are doing one thing incorrectly – you are trying to invoke your ‘ptr’ function before invoking ‘function’. What you were supposed to do is to pass just a pointer to ‘ptr’ and invoke ‘ptr’ using passed pointer from ‘function’ like that:
which gives:
which is what you wanted
for
to work – you would have to have sth like: