va_arg va_start va_end 获取函数参数内容
#include <stdio.h> #include <stdarg.h> int Ave_int(int,...); int main() { printf("%d\t",Ave_int(2,"test1","test2")); //printf("%d\t",Ave_int(4,6,5,2,3)); return 0; } int Ave_int(int v,...) { char * value_r; int i=v; va_list ap; va_start(ap,v); while(i>0){ value_r = va_arg(ap,char*); printf("value_r is %s\n",value_r); i--; } va_end(ap); return 0; }