I want to point to a function with arguments, except the argument is provided before invoking. It is not possible for me to provide the arguments while invoking, as I am dealing with different function with different amounts of arguments. The specific function I want to invoke without arguments is exit()
, so if there is version of the function exit with no arguments (not matter what the return code is) it will solve my problem as well.
This is what I am trying to do:
/*Point to exit() with argument provided 1. Am not trying to call the function just yet.*/
void *func = &exit(1);
/*Dereference and invoke the function. Provide no argument as they were already provided.*/
*(((void)()) func)();