Everyone knows about it, so just a summary about it.
Yes, C allows a function to be prototyped to accept variable number of arguments from the caller..
Its done with the help of stdarg header.. The representation looks like below:
int func( int first, ... )
Note the ellipsis in form "..." , it will be the last argument in the function prototype..
Some of the macros defined in stdarg.h do the job of variable argument list parsing..
va_list - The variable argument list should be of va_list type
va_start - initializes the list,
va_arg - returns the next argument in the list, and
va_end - cleans up the variable argument list.
Now, va_start() requires 2 arguments . Those are va_list object and the last one in the fixed argument list..
va_arg() requires 2 arguments and those are va_list object and the argument type..
Isnt it easy ?