← Previous Next →

Array is a homogenous collection of variables i.e. set of variables having same data type. 

  • Array might be belonging to any of the data types
  • Array size must be a constant value.
  • Contiguous (adjacent) memory locations are used to store array elements in memory.


int number[10]; // integer array
char name[10];  // character array

Types of C arrays:

  1. One dimensional array
  2. Multi dimensional array
    • Two dimensional array
    • Three dimensional array, four dimensional array etc…

1. One dimensional array in C:

Syntax :

data-type arr_name[array_size];

Example :

int number[5];

Array element can be accesessed using index
1st element : number[0]; 2nd element : number[1]; . . 5th element : number[4]; index go from 0 - (n-1) , where n is length of array.

2. Multi-dimensional array in C:

Syntax :

data-type array_name[size1][size2][.]..[];

Example :

Two dimensional array

data-type array_name[total_row][total_column]

int person[2][3];

person[0][0] person[0][1] person[0][2]
person[1][0] person[1][1] person[2][2]


← Previous Next →