 |
va_start |
Function (Macro) |
Initializes a pointer to a variable argument list.
Some C functions, such as sprintf have a variable number of arguments. This
function, together with va_arg and va_end,
provides a portable way to access
these argument lists. They are used for stepping through a list of arguments
when the called function does not know the number and types of the arguments
being passed. Function va_start (implemented as a macro) sets ap to point to the
first of the variable arguments being passed to the function. It must be
used before the first call to va_arg or va_end.
va_start takes two parameters: ap and lastfix. ap is explained
above, and lastfix is the name of the last fixed parameter being passed to the
called function.
Note: I used notation "&ap" in the prototype description, although passing by
reference does not exist in ordinary C (only in C++). However, this macro is implemented
in such a way that it simulates "passing by reference".