My problem is: I want to call the method, but I don't know at compile-time which arguments I want to pass.Is there some way by which I can create the va_list during run time and pass it to the fucntion. Eg Code: total(4, 1,2,3,4) ;//Where 4 is the number of arguments and 1,2,3,4 is my va_list; [CODE]int total( int numargs, ... ) { int sum = 0; int i ; int arg; va_list listpointer; va_start(listpointer,numargs); //printf(" The numarg value is %d\n",numargs); while(arg!= 0) { arg = va_arg(listpointer,int); //printf(" The arg returned %d",arg); sum += arg; } va_end(listpointer); printf("Total Purchase amount …

Member Avatar
Member Avatar
+0 forum 3

The End.