C examples for stdarg.h:va_end
macro
<cstdarg>
End using variable argument list
void va_end (va_list ap);
Parameter | Description |
---|---|
ap | va_list object previously initialized by va_start or va_copy. |
none
#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; }