As you are using C++, the obligatory suggestion that's still missing here, is to use std::vector<double>
.
You can easily pass it by reference:
void foo(std::vector<double>& bar) {}
And if you have C++11 support, also have a look at std::array
.
For reference: