C++ Programming - References - Discussion
Discussion Forum : References - Programs (Q.No. 12)
12.
Which of the following statement is correct about the program given below?
#include<iostream.h>
int main()
{
int arr[] = {1, 2 ,3, 4, 5};
int &zarr = arr;
for(int i = 0; i <= 4; i++)
{
arr[i] += arr[i];
}
for(i = 0; i <= 4; i++)
cout<< zarr[i];
return 0;
}
Discussion:
11 comments Page 2 of 2.
Virus said:
1 decade ago
There is an error in 5th line.
i.e. int &zarr = arr;
It must be &zarr = arr[5];
i.e. int &zarr = arr;
It must be &zarr = arr[5];
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers