/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
#include<stdio.h>
#include<stdarg.h>

int fun(int i, ...) {
  va_list ap;
 char buffer[30];

  va_start(ap, i);
  if(i==1)
    vsprintf(buffer, "%d", ap);
  else
    vsprintf(buffer, "%d %s", ap);
  printf("buffer = %s\n", buffer);
  va_end(ap);
  return 0;
}  

int main()
{
   fun(1, 10);
   fun(2, 20, "abcd");
}
