The va_arg macro

Name

va_arg -- 

Synopsis

#include <stdarg.h>

type va_arg (va_list ap, type);

Description

The va_arg macro expands to an expression that has the type and value of the next argument in the call. The parameter ap shall be the same as the va_list ap initialized by va_start. Each invocation of va_arg modifies ap so that the values of successive arguments are returned in turn. The parameter type is a type name specified such that the type of a pointer to an object that has the specified type can be obtained by simply postfixing a * to type. If there is no actual next argument (as promoted according to the default argument promotions), the behavior is undefined.

Returns

The first invocation of the va_arg macro after that of the va_start macro returns the value of the argument after that specified by paramN. Successive invocations return values of the remaining arguments in succession.

See Also

The va_start macro
The va_end macro