0
$\begingroup$

I have a doubt understanding How a 3-Dimensional array is stored in column Major Order. An array in Row Major order is stored like [plane][row][column] So, for finding address of any element we cross planes first, rows next and then some elements in that column.

But How is a 3-Dimensional array stored in Column Major Order?

It's better if understood from a problem.

A is an array $[2.....6,3.....8,4.......10]$ of elements. The starting location is $500$. The location of an element $A(5,5,5)$ using column major order is __________.

$\endgroup$
  • $\begingroup$ I do not understand your shifted array notation and it looks like school excersise (I might be wrong, should that be the case I am sorry for that), so it would be bad to give the answer, but I can check it if you describe what it is about and confirm your calculation if you need that. $A[0][0][0]$ has index $500$? $\endgroup$ – Evil Nov 23 '16 at 18:08
  • $\begingroup$ Above array notation means array as $A[5][6][7]$, but array indices start from $2,3$ and $4$ respectively. Btw no one gives homework like this in india. $\endgroup$ – mcjoshi Nov 24 '16 at 11:14
1
$\begingroup$

In the Row-major order the elements of rows are continous, so you have already described the Column-major order.

X-major order means that n-dimensional array when stored in the memory is flat for easy, sequential access if the X entries.

To find address of any element of the Column-major order: the first is plane, than row and the last is column.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.