There are 2 ways to do this:
-
Variadric macro
#define my_printf(...) printf(__VA_ARGS__) -
function that forwards
va_args#include <stdarg.h> #include <stdio.h> void my_printf(const char *fmt, ...) { va_list args; va_start(args, fmt); vprintf(fmt, args); va_end(args); }
There are also vsnprintf, vfprintf and whatever you can think of in stdio.