Row Major Representation
In memory the primary method of representing two-dimensional array is the row major representation. Under this representation, the primary row of the array occupies the first set of the memory location reserved for the array; second row occupies the next set, & so forth.
The representation of row major representation of an Array is shown in Figure
Let us assume the following two-dimensional array:
a b c d
e f g h
i j k l
In order to make its equivalent row major representation, we carry out the following procedure:
Move the elements of the second row beginning from the first element to the memory location adjacent to the very last element of the first row. While this step is applied to all the rows except for the first row, you contain a single row of elements. It is the Row major representation.
By application of above demoted process, we get {a, b, c, d, e, f, g, h, i, j, k, l }
Row 0
|
Row 1
|
Row 2
|
.....
|
Row i
|
|
|
Figure: Schematic of a Row major representation of an Array