Which of the following is true with respect to Reference?
2014
Which of the following is true with respect to Reference?
- A.
A reference can never be NULL
- B.
A reference needs an explicit dereferencing mechanism
- C.
A reference can be reassigned after it is established
- D.
A reference and pointer are synonymous
Attempted by 113 students.
Show answer & explanation
Correct answer: A
In C++, a reference is an alias for an existing object and must be initialized upon declaration. Unlike pointers, references cannot be null or reassigned to refer to a different object after initialization. Therefore, the statement that a reference can never be NULL is true.