I want to pass a function as argument to another function. I searched already Google about information on this and I found already a explanation but it doesn't work for me and I don't know why.
I have following code:
void doSomething(uint64_t *);
This is my function I want to pass.
int functionToCall(int x, int y, void (*f)(uint64_t *));
This is my function I want to call and pass the doSomething() function.
In my code now is:
uint64_t *state = malloc(sizeof(uint64_t) * 10);
void (*f)(uint64_t *) = doSomething;
functionToCall(2, 3, f(state));
If I compile the above code now I get always:
error: invalid use of void expression
What is the problem with that?