2 ms·
I usually don't let them creep into the API, but I use them for convenience within a function that needs direct access to the multidimensional structure, i.e.
by jedbrown 14y ago
I usually don't let them creep into the API, but I use them for convenience within a function that needs direct access to the multidimensional structure, i.e.
void func(int M, int N, int P, double *a_flat) {
double (*a)[N][P] = (double (*)[N][P])a_flat;
// use a[i+1][j+2][k-1] instead of a_flat[((i+1)*N+(j+2))*P+k-1].