Array

sAksham-Ar published on
1 min, 76 words

Categories: C++

An array in C++ is like a sequence of variables.Arrays have 0 based indexing which means the first element is stored in 0th place and last at size-1th place.array_name[index] gives the element at that place(index).

#include<iostream>
using namespace std;
int main()
{
    int a[5],i;
    for(i=0;i<5;i++)
        a[i]=i+1;
    for(i=0;i<5;i++)
        cout<<a[i]<<' ';
    return 0;
}

OUTPUT:

output