C++ program of defining array

      No Comments on C++ program of defining array

Defining array

This program illustrate the concept of defining array.It is program of single dimensional array.

  • Array store the elements in contiguous memory location.
  • The array size must be a integer type and it should be greater than 0.
  • In array the lowest address indicate the first element and the highest address indicate the last element.
  • Picture repersentation of array
  • defining array

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x[5],i;
x[0]=1;
x[1]=2;
x[2]=3;
x[3]=4;
x[4]=5;
cout<<"Elements of array are:- "<<endl;
for(i=0;i<5;i++)
{
 cout<<x[i]<<endl;
}
getch();
}

OUTPUT:-

defining array


Comment below if you are facing any problem


Also read

C++ program to Enter Elements of your choice in array
C++ Program to find the Largest element in the array
C++ Program to search a Element in Entered array

Leave a Reply

Your email address will not be published. Required fields are marked *