While using a variable reference, what will happen after compilation and execution of the code:
int arr[]={1,2,3};
for(int &i:arr){
    i=99;
}
for(int i=0;i<3;i++)
    cout<<arr[i]<<'\t';
Explanation
As in the first for expression used not a variable, but a variable reference, then the changes will be stored in the array elements (standard C ++ 11).

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes