In a C function declaration, what does "..." as the last parameter do?
it allows a variable number of arguments of unspecified type (like printf
does).
you have to access them with va_start
, va_arg
and va_end
see http://publications.gbdirect.co.uk/c_book/chapter9/stdarg.html for more information
Variadic functions
Variadic functions are functions which may take a variable number of arguments and are declared with an ellipsis in place of the last parameter. An example of such a function is
printf
.A typical declaration is
int check(int a, double b, ...);
Variadic functions must have at least one named parameter, so, for instance,
char *wrong(...);
is not allowed in C.