title: element address in 3 dimensional array
body: <p>I am looking for the formulas to find the memory location of an element in a 3-D Array for row major and for column major. After using my logic I end up with the following formulas.
  say array is <code>A[L][M][N]</code>.</p>
  
  <p>row-major:<code>Loc(A[i][j][k])=base+w(M*N(i-x)+N*(j-y)+(k-z))</code><br>
  column-major:<code>Loc(A[i][j][k])=base+w(M*n(i-x)+M*(k-z)+(j-y))</code></p>
  
  <p>where x, y, z are lower bounds of 1st(L) 2nd(M) and 3rd(N) index.
  I tried this formula and got the correct result but when I applied this formula on a Question in the book then the answer did not match. Please can anyone help me out with this.</p>