va_arg


Moving variable for scanning argument list

[Classification]

Standard library

[Syntax]

#include <stdarg.h>

typedef char __near *va_list;

type va_arg(va_list ap, type);

[Description]

This function returns the argument indicated by variable ap, and advances variable ap to indicate the next argument. For the type of va_arg, specify the type converted when the argument is passed to the function. Although a different type can be specified for each argument, stipulate "which type of argument is passed" according to the conventions between the called function and calling function.

Since a variable argument is converted according to default argument promotions, the type after conversion should be specified. If the argument is a pointer with a constant value, a cast must be attached to the argument to clearly show that it is a pointer. For details on default argument promotions, see "(7) Default argument promotions".

In addition, the "number of arguments that are actually passed" is determined according to the conventions between the called function and calling function.