I have an array, int dims[n]
, where n
means dims, for example n=3
means there are 3 dims.
dims[i]
stores the corresponding length of the dim.
I want to create an array, arr[dims[0]][dims[1]][...][dims[n]]
, is there any good methods?
(dims[n]
is not sure when the code is compiled, I am not able to define a certain format of arr
)
I need the array for a function with argument double*
, the function will read an n-dimensional array from file and could not put data into a 1-dimensional array (in this case, it will report an memory error and I am not able to reconfigure the function).