C++ does not support variable-length arrays. If len is a compile time constant, I'd advise you to use std::array with a template, like so:
template<size_t len>
void f(){
    std::array<double, len> arr;
    //use arr
}
And you would use it like that:
int main()
{
    f<5>();
}
Do note, that the 5 in my example is a compile-time constant. If you do not know the size of your array at compile time, use a std::vector. You'd do this like this:
void f(const size_t len){
    std::vector<double> arr(len);
    //use arr
}
int main()
{
    size_t variableLength = 0;
    std::cin >> variableLength;
    f(variableLenght);
}