.TH "va_start()" "" "" "Variable Arguments"
.PC "Point to beginning of argument list"
.B "#include <varargs.h>"
\fBvoid va_start(\fIlistptr\^\fB)\fR
\fBva_list \fIlistptr\^\fB;\fR
.sp \n(pDu
.B "#include <stdarg.h>"
\fBvoid va_start(\fIlistptr, rightparm\^\fB)\fR
\fBva_list \fIlistptr, type rightparm\^\fB;\fR
.PP
.B va_start()
is a macro that points to the beginning of a list of arguments.
It can be used with functions that take a variable number of arguments,
such as \fBprintf()\fR or \fBscanf()\fR, to help implement them portably.
It is always used with
.B va_arg()
and
.B va_end()
from within a function that takes a variable number of arguments.
.PP
This macro is defined in two different header files,
.B <stdarg.h>
and
.BR <varargs.h> .
The former header file is the creation of the ANSI C committee, whereas
the latter originates with \*(UN System V.
.II va_list
In both implementations, the first argument is
.IR listptr ,
which is of type
.BR va_list .
.PP
The implementation in
.B <stdarg.h>
(ANSI) adds a second argument,
.IR rightparm ,
which is the rightmost parameter preceding the variable arguments in
the function's parameter list.
Undefined behavior results if any of the following conditions apply to
.IR rightparm :
if it has storage class
.BR register ;
if it has a function type or an array type;
or if its type is not compatible with the type that results from
the default argument promotions.
.SH Example
For an example of this macro, see the entry for
.BR "stdarg.h" .
.SH "See Also"
.Xr "stdarg.h," stdarg.h
.Xr "varargs.h" varargs.h
.br
\*(AS, \(sc7.8.1.1
.SH Notes
For a discussion of how the
.B <stdarg.h>
and
.B <varargs.h>
implementations of the variable-argument routines differ,
.BR stdarg.h .
.PP
The \*(AS demands that
.B va_start()
be implemented only as a macro.
If the macro definition of
.B va_start()
is suppressed within a program, the behavior is undefined
(and probably unwelcome).
