Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)
va_end(3) Guardian Native C Library Calls Ref
erence Manual
NAME
va_end - Ends processing for a variable-length parameter list
LIBRARY
None. This application program interface is implemented as a macro.
SYNOPSIS
#include <stdarg.h>
void va_end(
va_list ap);
PARAMETERS
ap This parameter is used to extract parameters from the parameter list.
DESCRIPTION
The stdarg macros allow you to write portable functions that accept a variable number of param-
eters. Subroutines that have variable-length parameter lists but do not use these macros are not
portable because different systems use different parameter-passing conventions.
va_end ends processing for this variable-length parameter list.
EXAMPLES
The following example uses the stdarg macros to copy a variable-length parameter list that con-
sists of pointers to strings into an array, then passes the array and the number of pointers in it to
the function f2. The number of pointers is specified by the first argument to f1.
#include <stdarg.h>
#define MAXARGS 31
void f1(int n_ptrs, ... )
{
va_list ap;
char *array[MAXARGS];
int ptr_no = 0;
if (n_ptrs > MAXARGS)
n_ptrs = MAXARGS;
va_start(ap, n_ptrs);
while (ptr_no < n_ptrs)
array[ptr_no++] = va_arg(ap, char *);
va_end(ap);
f2(n_ptrs, array);
}
RELATED INFORMATION
Functions: va_arg(3), va_start(3), vfprintf(3).
7−38 Hewlett-Packard Company 527192-005