This is what my prototype says:
void buildArrays(double, double, double);
It looks okay. Not sure what the problem is.
Remember that the types in a function (or method) prototype must be consistent with the definition of the function. Your declaration tells the compiler that you have a function that takes three floating point numbers, not three arrays of floating point numbers. Edison is correct in that you need to include the [] in your function declaration. That tells the compiler that the arguments are arrays of 'double's, and not individual 'double' values. It helps to include the parameter names in the declaration (prototype), too, just like in the definition so it's more clear.
Try this:
void buildArrays(double gas[], double electricity[], double water[]);
A lot of the time I actually copy the header line from my function/method definition up to the top and turn it into the declaration. It helps avoid consistency problems.
I prefer to create only one variable per line, as it is easier to see. I don't know if it's different in C++, but in Java you declare it this way: double[] ArrayName = new double[numElements];
I also prefer one variable declaration per line
.
The syntax and semantics for arrays in C and C++ are quite a bit different than Java. Last time I used Java, it didn't have the same semantics for the arrays that Goalie is dealing with here. Not sure if the language has changed since then.
In fact, I think that's the problem, because the raised x might indicate an array, and it can't convert an array of doubles to a single double.
It's not a raised x, it's actually a star (*). It's the pointer syntax used by C and C++, and is a consequence of how C/C++ arrays were designed. Correct, the error message is saying that it can't convert the pointer to the array-of-double 'gas' into a double.
So double[] gas instead of double gas[].
In C/C++ the [] goes after the variable name.