liveBook · Manning

Va_arg

va_arg is a C and C++ macro that retrieves the next argument from a variable argument list as a specified type.

How 2 Manning books explain it

Modern C, Third Edition

va_arg is a C library macro that retrieves the next argument from a va_list using a specified type.

How it is used
Retrieves successive arguments while implementing a variadic function.
How deep it goes
Explains typed retrieval and length management, but does not descend into va_list implementation internals.
Examples
Uses a variadic function that sums n double values and retrieves each with an explicit double type.
What you can do after
Apply via C library macros to retrieve typed arguments from a variadic function.

Read how Modern C, Third Edition explains va_arg →

Modern C

va_arg is a C standard library macro that retrieves the next argument from a va_list using a specified type.

How it is used
Retrieves successive arguments while implementing a C variadic function.
How deep it goes
Defines the macro and demonstrates a typed loop, but does not descend into va_list internals.
Examples
Uses sumIt to retrieve and sum n double values from a variadic argument list.
What you can do after
Build it from scratch by iterating through a va_list with explicit retrieval types and caller-supplied length.

Read how Modern C explains va_arg →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.