I'm trying to make a program that receives a pointer to a function and the arguments, and then calls the function with the arguments. The best way to do it seems to be passing the arguments as an array, but I can't change the arguments accepted by the function.
This is similar to what I would like to do.
int add(int a, int b){
return a + b;
}
int add3(int a, int b, int c){
return a + b + c;
}
int main(){
int* args = calloc(sizeof(int) * 2);
add(args);
args = calloc(sizeof(int) * 3);
add3(args);
}