The 2-dimensional arrays are stored as 1-dimensional arrays in the computer’s memory.
Row Major Order Representaton:-
In this method, the first row elements are placed first, then the second row elements and so on.
Consider int a[3][4] ;where No. of rows=m=3, No. of Columns=n=4 ; is represented in row major order in visual(table) format as follows:

In Computer memory, it is represented in row major order as follows:

The formula to calculate,
Address of a[i][j] =Base Address + sizeof(data type)*(No. of Columns*i+j)
E.g. Address of a[1][0]
= 1000 + 2*(4*1+0)
= 1000+2*4
= 1000+8
=1008
Column Major Order Representaton:-
In this method, the first column elements are placed first, then the second column elements and so on.
Consider int a[3][4] ;where No. of rows=m=3, No. of Columns=n=4 ; is represented in column major order in visual(table) format as follows:

In Computer memory, it is represented in column major order as follows:

The formula to calculate,
Address of a[i][j]= Base Address + sizeof(Data Type)*(No. of rows*j+i)
E.g. Address of a[1][2]
= 1000 + 2*(3*2+1)
= 1000+2*7
= 1000+14
=1014
