I created a 1d array using the trick double* x = new double[var]; which seems to be the only way of creating an array with a variable size. However, I now need to use the parts of x --> (x[1], x[2], ..., x[i]) in a function that requires a double input, and I cannot do that with a double*.
Is there a way of solving this without entering the source code and trying to change the input method, or rather, is there a way of turning a double* to a double, or better yet, create a double with a variable input?
Thank you, that is accurate, but not what I was asking. I know I formulated the question poorly, sorry about that.
What I meant to ask is: when I attempt to make the size of a double[] using a variable, the error: expression must have a constant value
appears. The way to bypass this is to make the double[] into a double*[]. However, this type is not compatible with a function I want to run it through.
So my question is: do I have to rewrite the function, or is there a way of bypassing this error?