Array Types in C

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

In computer programming, an array is an object which stores a collection of similar elements. All the elements must be of same type. There are two different types of arrays such as Single Dimensional Array and Multi Dimensional Array
array types in c

Single Dimensional Array

The one-dimensional arrays are known also as vectors in mathematics. The data is stored in a linear form in single dimensional array. Every array contains only one subscript like array[]


Example Try It Now

Two Dimensional Array

Two 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 second subscript denotes column data. For example, if you can 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 rwo and column of those elements

Example Try It Now

Other Array Topics you might want to learn

Array Basics in C

Single Dimensional Arrays in C

Two Dimensional Arrays in C