Next: va_end, Previous: va_start, Up: Stdarg

#### 13.1.2 Extract a value from argument list

Synopsis

         #include <stdarg.h>
         type va_arg(va_list ap, type);

Description
`va_arg` returns the next unprocessed value from a variable argument list ap (which you must previously create with va_start). Specify the type for the value as the second parameter to the macro, type.

You may pass a `va_list` object ap to a subfunction, and use `va_arg` from the subfunction rather than from the function actually declared with an ellipsis in the header; however, in that case you may only use `va_arg` from the subfunction. ANSI C does not permit extracting successive values from a single variable-argument list from different levels of the calling stack.

There is no mechanism for testing whether there is actually a next argument available; you might instead pass an argument count (or some other data that implies an argument count) as one of the fixed arguments in your function call.

Returns
`va_arg` returns the next argument, an object of type type.

Portability
ANSI C requires `va_arg`.