Python has a partial function, like the example below:
func = partial(anyFunction, "some_argument")
turtle.Screen().onkey(func, "Up")
Thus, I can use arguments in a function I am passing as argument.
In C language there is something similar? I need it because in a certain function has as its parameter the pointer to another function. I need to pass an argument to this function. As in the case below:
void test(int value) {
printf("Value: %d\n", value);
}
void test2() {
printf("Test2!\n");
}
void makeYNQuestion(char question[], const void *yesFunction, const void* noFunction) {
[...]
}
makeYNQuestion("my question", &test, &test2);
Need to pass some value to the test. How to solve this?