C++ Programming - References - Discussion
Discussion Forum : References - General Questions (Q.No. 4)
4.
Which of the following statements is correct?
- Change a reference changes the referent.
- We can create an array of references.
Discussion:
11 comments Page 2 of 2.
Anu said:
3 years ago
Array of references is not allowed, where as reference to array is possible,
int &b[3]=a;
error: declaration of 'b' as array of references
22 | int &b[3]={1,2,3};
| ^
Reference to array:
int a[3] = {1,2,3};
int (&b)[3] =a;
int &b[3]=a;
error: declaration of 'b' as array of references
22 | int &b[3]={1,2,3};
| ^
Reference to array:
int a[3] = {1,2,3};
int (&b)[3] =a;
(2)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers