0

let's assume this variadic function is printing nice logs (without knowing its implementation because we don't care)

int printLog(int bla, int foo, const char *format, ...);

in the following code how do I affect the arguments?

void myFunction(int param)
{
    typedef int (*myPrint) (const char *, ...);
    if(param > 0)
    {
         myPrint = printLog; //how do I pass half of the argument here?
    }
    else
    {
         myPrint = printLog(1,2,...); //this is what I would like
    }

   //then use it
   myPrint("Hello World");
   unsigned int blah=1;
   myPrint("blah is %d",blah);
}
Guillaume D
  • 2,202
  • 2
  • 10
  • 37

0 Answers0