/* */ Click to Join Live Class with Shankar sir Call 9798158723

One Dimensional Array in C++.

A single dimensional array (also called one dimensional array) is a linear list consisting of related data items of same type . In memory all the data items are stored in contiguous memory locations one after the other.

One dimensional array represents one row or one column of array elements that share a common name and is distinguishable by index values.

Initialization of single dimensional array.

Array can be initialized at the time of declaration when their initial value are known in advance array elements can be initialized with data items of type integer , character , float etc .the value are copied into array in the order specified in the declaration.

Example :-
int arr[5]={ 5, 7, 8, 4, 3 };
Initialization without size
int arr[ ]={4, 6, 2, 3 , 7};
Initialization with a string
char arr[ ]=“computer”;
Assigning values to array
Int a[5];

Q.) Program to input 10 numbers in an array and display only the even numbers if present in the array.

    #include < iostream>
#include < conio.h>

using namespace std;

int main()
    int a[10], i;

    cout<<"Enter 10 numbers\n";
    for(i=0; i< 10; i++)

    cout<<"List of even numbers\n";
    for(i=0; i< 10; i++)
            cout<< a[i]<<" ";
    return 0;
Enter 10 numbers
11 15 28 31 49 54 72 81 93 14
List of even numbers
28 54 72 14