C++ Program for Memory Allocation of Array
Master C++ with Real-time Projects and Kickstart Your Career Start Now!!
Program 1
// Memory allocation of array
#include<iostream>
#define clrscr() system("cls")
using namespace std;
int main()
{
int ar[5],n;
int i;
clrscr();
cout<<"\nEnter size of array";
cin>>n;
cout<<"\nEnter element in array\n";
for(i=0;i<n;i++)
cin>>ar[i];
ar[2]=65;
cout<<"\nArray elements: \n";
for(i=0;i<n;i++)
cout<<ar[i]<<endl;
return 0;
}
Your opinion matters
Please write your valuable feedback about DataFlair on Google

