void v
a_start(v
a_list ap, last)
type v
a_arg(v
a_list ap, type)
void v
a_end(v
a_list ap)
void v
a_copy(v
a_list dest, v
a_list src)
int vprintf(
const char *format, va_list ap);
int vfprintf(FILE *stream,
const char *format, va_list ap);
int vsprintf(
char *str,
const char *format, va_list ap);
int vsnprintf(
char *str, size_t size,
const char *format, va_list ap);
举例
void func(const char *format,
...)
{
va_list ap;
char *str;
va_start(ap, format);
vprintf(format, ap);
while(
...)
{
str = va_arg(ap, char*);
printf(
"str = %s\n", str);
}
va_end(ap);
return;
}
int main()
{
func(
"hello %s %s",
"furong",
"quange");
return 0;
}