void func(int n,...);
void main()
void func(int n,...)
  int i,t,sum=0;
  va_list li;
printf("Sum = %d",sum);
This program outputs 6...
va_list is lyk datatype to handle variable arguments..
va_start takes the variable of va_list and the no. of variable arguments u r going to enter(i.e., nothing but the first argument in the func declaration)... and va_start points to the first of the variable arguments..
va_arg takes that variable of va_list and the return type that is expected..
At the end , va_end clears the list..
Note: No. of variable arguments u r going to enter must be mentioned in the definition and
there should be atleast one argument defined before the variable arguments and the ... should at the end of the argument list.. and the variable of va_list ,the same should be used for the other va_xxxx functions..

i hope i have mentioned everything right..
but i have a problem to be cleared...that is..
this works if all the variable arguments are of same type..wat if i want each one of the variable argument be of different data type.. ???

Last edited by shabbir; 11Nov2012 at 10:13.. Reason: Code blocks