COHERENT manpages
This page displays the COHERENT manpage for va_arg() [Return pointer to next argument in argument list].
List of available manpages
Index
va_arg() -- Variable Arguments Return pointer to next argument in argument list #include <stdarg.h> typename *va_arg(listptr, typename) va_list listptr, typename; #include <varargs.h> typename *va_arg(listptr, typename) va_list listptr, typename; va_arg() returns a pointer to the next argument in an argument list. It can be used with functions that take a variable number of arguments, such as printf() or scanf(), to help write such functions portably. It is always used with va_end() and va_start() within a function that takes a variable number of arguments. listptr is of type va_list, which is defined in the headers <stdarg.h> and <varargs.h>. This object must first be initialized by the macro va_start(). typename is the name of the type for which va_arg() is to return a pointer. For example, if you wish va_arg() to return a pointer to an integer, typename should be of type int. va_arg() can only handle ``standard'' data types, i.e., those data types that can be transformed to pointers by appending an asterisk `*'. Example For an example of this macro, see the entry for stdarg.h. See Also stdarg.h, varargs.h ANSI Standard, §7.8.1.2 Notes There are two different versions of va_arg(): the ANSI version, which is defined in <stdarg.h>; and the UNIX version, which is defined in <varargs.h>. For a discussion of how these implementations differ, see the entry for stdarg.h. If there is no next argument for va_arg() to handle, or if typename is incorrect, then the behavior of va_arg() is undefined. The ANSI Standard demands that va_arg() be implemented only as a macro. If its macro definition is suppressed within a program, its behavior is undefined.