variable arguments in functions
I can define a function like this
But I would like to have a variable argument. For example I can make the above function find the mean average of two numbers. But I would like to have it find the mean average of a variable number of numbers, namely the numbers defined in a vector in another part of the program. i.e. The user enters how many numbers he would like to find the average of, then enters those numbers, and the function finds the average. I tried something like this
int someFunction(int x, int y)
But this was pretty much a stab in the dark and I wasn't surprised when it didn't compile :P
Is it a pretty complicated technique, or is it a simple fix?
Thanks in advance :)