C++ Programming - References - Discussion

Discussion Forum : References - General Questions (Q.No. 12)
12.
Which of the following statements is correct?
  1. We can return a global variable by reference.
  2. We cannot return a local variable by reference.
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:
23 comments Page 3 of 3.

Sergey D said:   8 years ago
Correct answer is C: Both 1 and 2 are correct.

Test must be corrected.

Rupesh said:   6 years ago
We can return only static variable by reference.

Rahul said:   1 decade ago
@nidhi : Agreed !!! both options are correct..


Post your comments here:

Your comments will be displayed after verification.