You can use variable argument list.
Try to check for va_list, va_start(), va_end()
Here is a sample program
#include <stdio.h>
#include <stdarg.h>
int my_printf(char* format, ...)
{
va_list arg;
int ret =0;
va_start(arg, format);
ret = vfprintf(stderr, format, arg);
va_end(arg);
return ret;
}
int main()
{
my_printf("Welcome to QueryHome\n");
return 0;
}