From my main method, I want to declare an array of doubles (but not initialize it) and pass that to a function. In that function, the array will be initialized with some values. Now back in my main method, I want to read and display those values.
populateValues (double*& values) {
    values [0] = 100;
    values [1] = 200;
    values [2] = 300;
}
int main() {
    double values[3];
    populateValues(values);
    for (int i=0; i <3; i++) {
        std::cout << values[i] << std::endl; 
    }
}
However, when I compile the above, I get the error message:
error: invalid initialization of non-const reference of type ‘double*&’ from an rvalue of type ‘double*’
There is something wrong in how I am passing the parameter no doubt, but I don't know how to fix it.
 
     
    