va_end - C stdarg.h

C examples for stdarg.h:va_end

type

macro

from

<cstdarg>

Description

End using variable argument list

Prototype

void va_end (va_list ap);

Parameters

ParameterDescription
ap va_list object previously initialized by va_start or va_copy.

Return Value

none

Demo Code


#include <stdio.h> /* puts */
#include <stdarg.h> /* va_list, va_start, va_arg, va_end */

void PrintLines (char* first, ...)
{
  char* str;/* ww  w.  java  2s. c  o  m*/
  va_list vl;

  str=first;

  va_start(vl,first);

  do {
    puts(str);
    str=va_arg(vl,char*);
  } while (str!=NULL);

  va_end(vl);
}

int main ()
{
  PrintLines ("First","Second","Third","Fourth",NULL);
  return 0;
}

Related Tutorials