I am looking at the QCC package, and one function has
void QccStringSprintf(QccString qccstring, const char *format, …)
I didn’t know what the right most ‘…’ characters. After searching some info about it, I found the function allows variable number of variables. So I put one good example directly from
http://publications.gbdirect.co.uk/c_book/chapter9/stdarg.html
Amplify’d from publications.gbdirect.co.uk
#include <stdlib.h> #include <stdarg.h> #include <stdio.h> int maxof(int, ...) ; void f(void); main(){ f(); exit(EXIT SUCCESS); } int maxof(int n args, ...){ register int i; int max, a; va_list ap; va_start(ap, n args); max = va_arg(ap, int); for(i = 2; i <= n_args; i++) { if((a = va_arg(ap, int)) > max) max = a; } va_end(ap); return max; } void f(void) { int i = 5; int j[256]; j[42] = 24; printf("%dn",maxof(3, i, j[42], 0)); }
See this Amp at http://amplify.com/u/bltfu


