Assigning and Accessing array elements

Assigning and Accessing array elements:

Initialisation of array element is done at the time of declaration. After the declaration if we want to provide the value for array elements then it must be assigned.

For example

int a[2][3];

a[0][1]=5;

Above array a is declared with 2  rows and 3 columns but not initialised. After the declaration the value is provided to a[0][1] and this is called as assigning value

To access the array elements :

If we want to access any element say to access first element of array we should write array name followed by indexes.

a[rowindex][columnindex]

a[0][0].

Comments