 |
va_arg |
Function (Macro) |
Returns the current argument in the list.
This function (also implemented as a macro) expands to an expression that
has the same type and value as the next argument being passed (one of the
variable arguments). The variable ap to va_arg should be the same
ap that va_start initialized. Because of
default promotions, you can't use char or unsigned char types with va_arg.
The first time va_arg is used, it returns the first argument in the list. Each
successive time va_arg is used, it returns the next argument in the list. It
does this by first dereferencing ap, and then incrementing ap
to point to the following item.
va_arg uses the parameter type (which must be an expected type name) to both
perform the dereference and to locate the following item. Each successive time va_arg
is invoked, it modifies ap to point to the next argument in the list.