Arrays 2-d

Sandhya Reyya
1 min readNov 22, 2020

--

In the previous story we have seen single dimensional array. Now let’s move to the multidimensional arrays .

Multidimensional array is defined as array of arrays. Here we will see 2-dimensional array which is also called as Matrix.

The keywords used in 2-d arrays are

row: The horizontal reference of a matrix.

column: The vertical reference of a matrix.

item : The value stored at r’th row and c’th column in a matrix.

Just like 1-d array ,here also row’s and column’s index starts from 0 and ends with r-1,c-1 where r is number of rows and c is number of columns.

  • Traversal is applicable on a matrix.
  • Addition and subtraction are performed on 2 matrices only when number of rows and columns are same in 2 matrices.
  • Multiplication is also done only when the number of columns of first matrix is equal to number of rows in second matrix.
  • Division of matrices are not possible .

The following are the programs on 2-d arrays

C

java

This is all about 2-d arrays. In the same way we can have more multidimensional arrays.

My next story is regarding Linked list and its types.

Thank you.

--

--

Sandhya Reyya
Sandhya Reyya

No responses yet