Pointer of a function with variable number of arguments
16:31 27 Apr 2014

I have a function with the following prototype:

void func(int an, ...);

And I would like to store the address of this function and call it later. I have really no idea to how to do that, I desperately tried:

void (*funcPtr)(int, ...);  // Declaration
funcPtr = func;     // Storage
(*funcPtr)(3,2,5);      // Call

This code compiles fine, but at execution it does crap, when I enter my function the arguments in my va_list are not the ones I sent.

Thanks in advance.

EDIT : Alright, I just forgot the first argument. In my code above, the call line should be replaced with:

(*funcPtr)(3,3,2,5);        // Call
c function-pointers