Two Dimensional Arrays in C

Last Updated Nov 20, 2015, 07:00:14 PM

Multi Dimensional or Two dimensional arrays are often used to store both row and column data in arrays. These arrays are also called as Matrix. Two dimensional arrays require more than one subscript like array[] [] to store both row and column values

In a two dimensional array the first subscript denotes the row data and the second subscript denotes column data. For example, if you create an array like array [3] [4], which means it has 3 rows and 4 columns

Array Types

In the above two dimensional array image, we have row data as car names and column data as price. In this case, let us see how two dimensional array can store and access the data with an example

Let us say, we want to access the price of Ferrari car and also the price of Audi car.

While accessing the elements in two dimensional array, we need to give the indexes of both row and column of those elements

Example Try It Now

Other Array Topics you might want to learn

Array Basics in C

Arrays Types in C

Single Dimensional Arrays in C