INtime SDK Help
va_arg, va_end, va_start (ANSI)

Access variable-argument lists.

#include <stdarg.h>
#include <stdio.h>

type va_arg (va_list arg_ptr, type);

void va_end (va_list arg_ptr);

void va_start (va_list arg_ptr, prev_param);


Pointer to variable-argument list.
Parameter preceding first optional argument.
Type of argument to be retrieved.


These macros provide a portable way to access a function's arguments when the function takes a variable number of arguments. Use the va_start macro before using va_arg for the first time. The macros behave as follows:

Macro Description
va_arg Retrieves type parameter from the location given by arg_ptr. Increments arg_ptr to point to the next argument in the list, using the size of type parameter to determine where the next argument starts. Use this macro multiple times to retrieve all arguments from the list.
va_end After all arguments have been retrieved, resets arg_ptr to a null pointer.
va_start Sets arg_ptr to the first optional argument in the variable-argument list. The arg_ptr argument must be of the va_list type. The argument prev_param is the name of the required parameter immediately preceding the first optional argument in the argument list. If prev_param is declared with the register storage class, the macro's behavior is undefined.

The macros assume that the function takes a fixed number of required arguments, followed by a variable-argument list.

Return Values

va_arg returns the current argument.

va_start and va_end do not return values.


Versions Defined in Include Link to
INtime 3.0 intime/rt/include/stdarg.h stdarg.h

More info.

See Also

STDARG.H, vfprintf, vprintf, vsprintf