Row Major Order Representation of Array
Row Major Order is a method of representing multi dimension array in sequential memory.
In this method elements of an array are arranged sequentially row by row. Thus elements of first row occupies first set of memory locations reserved for the array, elements of second row occupies the next set of memory and so on.
Consider a Two Dimensional Array consist of N rows and M columns. It can be stored sequentially in memory row by row as shown below:
Row 0  A[0,0]  A[0,1]  .................  A[0,M1] 
Row 1  A[1,0]  A[1,1]  .................  A[1,M1] 
................................................................  
Row N1  A[N1,0]  A[N1,1]  .................  A[N1,M1] 
Example:
Consider following example in which a two dimensional array consist of two rows and four columns is stored sequentially in row major order as:
2000 
A[0][0] 
Row 0 
2002 
A[0][1] 

2004 
A[0][2] 

2006 
A[0][3] 

2008 
A[1][0] 
Row 1 
2010 
A[1][1] 

2012 
A[1][2] 

2014 
A[1][3] 
The Location of element A[i, j] can be obtained by evaluating expression:
LOC (A [i, j]) = Base_Address + W [M (i) + (j)]
Here,
Base_Address is the address of first element in the array.
W is the word size. It means number of bytes occupied by each element.
N is number of rows in array.
M is number of columns in array.
Suppose we want to calculate the address of element A [1, 2].
It can be calculated as follow:
Here,
Base_Address = 2000, W= 2, M=4, N=2, i=1, j=2
LOC (A [i, j])  =  Base_Address + W [M (i) + (j)] 
LOC (A[1, 2])  =  2000 + 2 *[4*(1) + 2] 
=  2000 + 2 * [4 + 2]  
=  2000 + 2 * 6  
=  2000 + 12  
=  2012 