arrays to va_list
This program works if I skip the first 3 arguments in the list but if I send "average(3, 0,1,2)" it works without skiping the first three arguments, as it should. Why can I not send the array?
Thanks for any help you can give me.
double average(int num,...)
if(x>2) //why do I have to do this to make this program work?
cout<<"\nso far "<<sum;
cout<<endl<<"The Average is "<<average(x,mynum);
Why do you want to use va_list with array? are you going to use many arrays in the call? like this: average(x, numarray1, numarray2, numarray3)? If not, skipp the va_list idea just have a function like this: average(int numInArray, int numArray). In fact I've never seen an array used as a va_arg. I think the point with va_list is to get rid of the array...
Someone else might have an better answer than this though...
Okay, so I'm an idiot. Thanks, I got caught up in trying to use the macros and forgot my basic skills!
I still wonder why it works skipping the first three arguments?