.TH "va_end()" "" "" "Variable Arguments"
.PC "Tidy up after traversal of argument list"
.B "#include <stdarg.h>"
\fBvoid va_end(\fIlistptr\^\fB)\fR
\fBva_list \fIlistptr\^\fB;
.sp \n(pDu
.B "#include <varargs.h>"
\fBvoid va_end(\fIlistptr\^\fB)\fR
\fBva_list \fIlistptr\^\fB;
.PP
.B va_end()
helps to tidy up a function after it has traversed
the argument list for a function that takes a variable number of arguments.
It can be used with functions that take a variable number of arguments,
such as
.B printf()
or
.BR scanf() ,
to help write such functions portably.
It should be used with the routines
.B va_arg()
and
.B va_start()
from within a function that takes a variable number of arguments.
.PP
.I listptr
is of type
.BR va_list() ,
which is declared in header
.BR stdarg.h .
.I listptr
must first have been initialized by macro
.BR va_start .
.SH Example
For an example of this function, 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.3
.SH Notes
There are two different versions of
.BR va_end() :
the ANSI version, which is defined in
.BR <stdarg.h> ;
and the \*(UN version, which is defined in
.BR <varargs.h> .
For a discussion of how these implementations differ, see the entry for
.BR stdarg.h .
.PP
If
.B va_list()
is not initialized by
.BR va_start() ,
or if
.B va_end()
is not called before a function with variable arguments exits,
then the behavior of
.B va_end()
is undefined.
