Metalingus Metalingus - 2 months ago 35
C Question

Array's address with dimension greater than 3

What is the MATHEMATICAL function that gives the address of an array with more than 3 dimensions?
I already know that for an array a[x][y] with 2 dimensions is (a+(x*max_second_dimension+y)*byte)


let dimension of array be lxbxhxg which means array has declared using

data_type  array[l][b][h][g];

if you want address of cell at array[x][y][z][a] then it will be

array + (x*b*h*g + y*h*g + z*g + a) * sizeof(array[x][y][z][a])