One Dimensionalal Aray

Card image cap

One Dimensionalal Array ?

A one-dimensional array is a group of elements having the same datatype and same name. Individual elements are referred to using common name and unique index of the elements.


The simplest form of an array is one-dimensional-array. The array itself is given name and its elements are referred to by their subscripts. In C++, an array is denoted as follows:

An array is a collection of data that holds homogeneous values. That means values should be in same type

Syntax:

type variable_name[size]


Card image cap

Example 1:



Output:

 arr[0] =1
 arr[1] =2
 arr[2] =3
 arr[3] =4
 arr[4] =5
Card image cap