Write down about the three types of arrays.

One dimensional array: 

A list of items can be given one variable name using only one subscript and such a variable is called a one dimensional array.

              Example : int number[5];

Here in the example, 5 value of the variable number can be kept under the single variable number.

Two dimensional array: 

When by using an array user can store two value, each for a row and a column under a variable, the array is then called a two dimensional array. Here, user can use infinite number of rows and columns. Two dimensional arrays are declared as follows,

                 type array_name[row size][column size];

Multidimensional array: 

C allows arrays of three or more dimensions. The exact limit is determined by the compiler. The general form of a multidimensional array is,

              type array_name[s1][s2]......[sn];

Where sn is the size of the dimension. For example,

              int survey[3][5][12]

Here survey is a three dimensional array declared to contain 180 integer type elements.

Author: Tanmay Chakrabarty

Tanmay Chakrabarty is a former CSE student, currently working as a Senior Software Engineer with 5+ years of experience in the field of Web Application development in PHP+MySQL platform with strong skills in Javascript, JQuery, JQuery UI and CSS. He tries to write notes every week but fails due to heavy loads of duty.

Recommended Recommends


Contact Us