Variable Arguments: stdarg.h
The stdarg.h header file provides a means for defining a function having a variable number of arguments. The prototype for such a function should have a parameter list with at least one parameter followed by ellipses:
void f1(int n, ...); /* valid */ int f2(int n, const char * s, ...); /* valid */ double f3(...); /* invalid */
In the following, the term parmN is the identifier used for the last parameter preceding the ellipses. In the preceding examples, parmN would be n for the first case and s for the second case.
The header file declares a va_list type to represent a data object used to hold the parameters corresponding to the ellipses part of the parameter list. Table RS.V.19 lists three macros to be used in ...
Get C Primer Plus, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.