I have a function pointer in a structure, with a void* argument. I would like to pass this function to another one, but I get compilation errors...
This is the function declaration in the structure:
void (*on_click)(void *);
And this is how I pass the function pointer to my function, where box is a structure:
but1 = create_button(posbut, "test", BUTTON_DEF, &on_click((void *)box));
I have the error: cannot convert to a pointer type, and lvalue required as unary ‘&’ operand on this line.
Thanks !
create_button. Also, if that is a declaration in a structure, then you cannot just writeon_click, you have to use a structure access operator with a structure variable&on_click((void *)box)is wrong becauseon_click((void *)box)is not a function, it's a function call. It should be&on_click(or juston_clickfor short).