I have a problem with my code. I have input for a class, nmax und mmax. They are defined in the title as
int nmax; int mmax;
Then I have some arrays defined in the header as
double* Nline; double** NMline;
and then I would like to highlight them in the main program. First, I assign nmax und max value from input
nmax = nmax_in; mmax = mmax_in;
and then I allocate arrays
Nline = new double [nmax]; NMline = new double [nmax][mmax];
The problem is that a 1D array is allocated this way. But the 2D array is not - the compiler writes: the expression must have a constant value
Why was NLine allocated and NMline not?
I understand, but I donβt know how to do this in my program, and why for a 1D array this distribution is fine. Thank you very much for your help.
source share