You are on page 1of 2

ROW MAJOR ORDER © Samiran Baishya

Elements are stored Row wise. Rows are listed on the basis of columns.

Addr of element = B + W(N(I-LR) +(J-LC)

B = Base Addr
W = sizeof(element)
N = No of columns
LR = Lower bound of row
LC = Lower bound of column
I = Desired row
J = Desired column

A[0][0] A[0][1] A[0][2] A[0][3]

A[1][0] A[1][1] A[1][2] A[1][3]

A[2][0] A[2][1] A[2][2] A[2][3]

A[0][0] A[0][1] A[0][2] A[0][3] A[1][0] A[1][1] A[1][2] A[1][3] A[2][0] A[2][1] A[2][2] A[2][3]

ROW 1 ROW 2 ROW 3 ROW 4


COLUMN MAJOR ORDER © Samiran Baishya

Elements are stored Column wise. Columns are listed on the basis of rows.

Addr of element = B + W(N(J-LC) +(I-LR)

B = Base Addr
W = sizeof(element)
N = No of Rows
LR = Lower bound of row
LC = Lower bound of column
I = Desired row
J = Desired column

A[0][0] A[0][1] A[0][2] A[0][3]

A[1][0] A[1][1] A[1][2] A[1][3]

A[2][0] A[2][1] A[2][2] A[2][3]

A[0][0] A[1][0] A[2][0] A[0][1] A[1][1] A[1][1] A[0][2] A[1][2] A[2][2] A[0][3] A[1][3] A[2][3]

COL 1 COL 2 COL 3 COL 4

You might also like