I have a filled one-dimensional array double *vals as a class component with sizes Nn[0]*Nn[1]. I need to get 2-dimensional array **w (w[Nn[1]][Nn[0]]) without allocating new memory for it, e.g. i need to represent vals as 2-dimensional array.
Using g++ compiler i can make
double (* w)[Nn[0]] = (double (*)[Nn[0]])val;
But VS compiler or intel compiler don't allow to use non-constant expression as dimension array.
In general, I can just use element in initial vals array converting 2 int indices (i,j) of w[i][j] element into global index and do not declare w at all. But it would be great if it's possible to get 2-dimensional array w on initial memory (with compiling with intel compiler too). So is there any way to do it?
double *valsis not an array. It's a pointer.