2 dimensional array
Twodimensional array are those type of array, which has
finite number of rows and finite number of columns. The declaration form of
2dimensional array is
Data_type Array_name [row size][column size];
The type may be any valid type supported by C. The rule for
giving the array name is same as the ordinary variable. The row size and column
size should be an individual constant.
The following declares a twodimensional 3 by 3 array of
integers and sets the first and last elements to be 10.
int matrix [3][3];
matrix[0][0] = 10;
matrix[2][2] = 10;
The following Figure illustrates a two dimensional
array, matrix. The array contains three rows and tree columns, so it is
said to be a 3by3 array. In general, an array with m rows and n
columns is called an mbyn array.

[0]

[1]

[2]

[0]

10



[1]




[2]



10

Every element in array matrix is identified by an element
name of the form matrix[ i ][ j ]; matrix is the name of the array, and i and j
are the subscripts that uniquely identify each element in matrix . Notice that
the names of the elements in the first row all have a first subscript of 0; the
names of the elements in the third column all have a second subscript of 2.
In the case of Twodimensional array, during declaration
the maximum number of rows and maximum number of column should be specified for
processing all array elements.
The implementation of the array stores all the elements in a
single contiguous block of memory. The other possible implementation would be a
combination of several distinct onedimensional arrays. Thatâ€™s not how C does
it. In memory, the array is arranged with the elements of the rightmost index
next to each other. In other words, matrix[1][1] comes right before matrix[1][2]
in memory.
The following array:

[0]

[1]

[2]

[0]

1

2

3

[1]

4

5

6

[2]

7

8

9

would be stored:
Example:
