C++ Programming - References - Discussion

Discussion Forum : References - General Questions (Q.No. 4)
4.
Which of the following statements is correct?
  1. Change a reference changes the referent.
  2. We can create an array of references.
Only 1 is correct.
Only 2 is correct.
Both 1 and 2 are correct.
Both 1 and 2 are incorrect.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
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;
(2)


Post your comments here:

Your comments will be displayed after verification.