Array in C++ by R4R Team

What is Array?
Array is a linear data structure in C++ which store similar kind of data like integer array, char array, float araray etc.
-collection of different data type are not allowed in array like
-collection of integer and string is not the array

Syntax-
data_type variable_name[size];

Example-
int var[20];
char s[20];

program:

#include< iostream>
using namespace std;
int main()
{
//array declaration
int arr[10];
int i;
//input in array
cout<<"Enter 10 element in arrayn";
for(i=0;i< 10;i++)
cin>>arr[i];
//Display the array
cout<<"Your array is: n";
for(i=0;i< 10;i++)
cout<< arr[i]<<" ";
return 0;
}


output-

Enter 10 element in array
10 20 30 40 50 60 70 80 90 100
Your array is:
10 20 30 40 50 60 70 80 90 100




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!