Table of Contents | Previous | Next |
The header <stdarg.h>
provides facilities for
stepping through a list of function arguments of unknown number and type.
Suppose lastarg is the last named parameter of a function
f
with a variable number of arguments. Then declare
within f
a variable ap
of type
va_list
that will point to each argument in turn:
va_list ap;
ap
must be initialised once with the macro
va_start
before any unnamed argument is accessed:
va_start(va_list ap, lastarg);The macro
void va_end(va_list ap);must be called once after the arguments have been processed but before
f
is exited.
Table of Contents | Previous | Next |
Last modified: Thu Dec 7 11:10:45 2000