作者:xqls_xqls
#include
#include
void PrintFloats ( int amount, ...)
{
int i;
double val;
printf ("Floats passed: ");
va_list vl;
va_start(vl,amount);
for (i=0;i
{
val=va_arg(vl,double);
printf ("/t%.2f",val);
}
va_end(vl);
printf ("/n");
}
int main ()
{
PrintFloats (3,3.14159,2.71828,1.41421);
return 0;
}
#include
#include
void PrintLines ( char* first, ...)
{
char* str;
va_list vl;
str=first;
va_start(vl,first);
do {
printf ("%s/n",str);
str=va_arg(vl,char*);
} while (str!=NULL);
va_end(vl);
}
int main ()
{
PrintLines ("First","Second","Third","Fourth",NULL);
return 0;
}