Hi, Is it possible to allocate a 1D memory space
int *x=(int *)malloc(100*sizeof(int));
and then recast the returned pointer to 2D array e.g.
int **y=(int **)x;
and access it as if it was 2D array e.g. y[1][2] = 12;
?
My aim is to take a shared memory segment and return 1D,2D,...ND array depending how the user wants to interpret this linear space with maximum efficiency (i.e. without declaring a new N-Dimensional array and copy data into it).
On a second note, is there a library for C which handles N-dimensional arrays, getting slices from them and transposing them efficiently (e.g. converting row-major to col-major)?
thanks, bliako