Coupon Accepted Successfully!


One-Dimensional Array Declaration And Initialization

The declaration of a one-dimensional array is as follows:


int a[5];

​It tells the compiler that
‘a’ is an integer type of array, and it should store five integers. In this example, 5 is the subscript enclosed within square brackets. The compiler reserves two bytes of memory for each integer array element; that is, 10 bytes are reserved for storing five integers in the memory.


In the same way, arrays of different data types are declared as follows:

One-dimensional Array Declaration

char ch[10];

float real[10];

long num[5];

The array initialization is done as follows:

Array Initialization

int a[5] = {1,2,3,4,5};

Here, five elements are stored in an array ‘a’. The array elements are stored sequentially in separate locations. Then, the question arises of how to call each element individually from this bunch of integer elements. The reading of array elements begins from

Array elements are accessed with the name of the array, and the number within the square brackets specifies the element number. In other words, array elements are called with array names followed by element numbers. Table explains the accessing elements.

Table: Calling Array Elements

a[0] refers to 1st element i.e. 1

a[1] refers to 2nd element i.e. 2

a[2] refers to 3rd element i.e. 3

a[3] refers to 4th element i.e. 4

a[4] refers to 5th element i.e. 5

Test Your Skills Now!
Take a Quiz now
Reviewer Name