int AR[50];
cout<<"Enter the elements of the array : "<<endl;
for(int i = 0 ; i < 5 ; i++)
cin>>AR[i];
so in the code I only initialized or gave values for the first five elements, what happens to the rest of it I mean are they null like '\0' or some junk is present there ?
AR[0] will be initialized by 1, AR[1] will be initialized by 2 and all other elements will be initialized by 0.
But in your example there is no initialization of the array. You are assigning values to elements of the array after its declarfation. So the other elements will have undefined values.