69,382
社区成员
发帖
与我相关
我的任务
分享
vprintf(fmt, args);
#include <stdio.h >
#include "stdarg.h"
void (*error1)(const char *format, ...)
__attribute__((noreturn))
__attribute__((format(printf, 1, 2)));
void simple_va_fun(const char *format,...) ;
void caller1();
int main()
{
caller1();
}
void caller1()
{
error1 = &simple_va_fun;
error1("n=%d,%d,%d,%d,%d,\n", 4,5,4,7,3,8,2,9,100);
}
void simple_va_fun(const char *format,...)
{
va_list arg_ptr;
int nArgValue =3;
int nArgCout=0;
va_start(arg_ptr,format);
do
{
++nArgCout;
printf("the %d th arg: %d",nArgCout,nArgValue);
nArgValue = va_arg(arg_ptr,int);
}while(nArgValue != 100);
return;
}