C++ Programming - References - Discussion

Discussion Forum : References - General Questions (Q.No. 2)
2.
Which of the following statements is correct?
  1. Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
  2. A reference is not a constant pointer.
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:
16 comments Page 2 of 2.

Chanchal said:   1 decade ago
Pointer take the reference of another variable also and it is not a constant pointer because we can change it.

Yadav said:   1 decade ago
Pointer can change its reference, it is not a constant.

What does the second statement mean?

A reference is not a constant pointer.

Karthik said:   1 decade ago
2 is incorrect because reference once created alias i.e., initialized with the variable must not be assigned once again with the another new another. So, it seems like const pointer.

Ashish said:   1 decade ago
Can anyone please explain. Why the 2nd option is incorrect?

Sireesha said:   1 decade ago
You can always change the address being pointed by 'p' and also value at 'p' unless they are constant similar is the case with the reference variable.

Nidhi said:   1 decade ago
2 is correct
becuase a refrence can be thaught of as (*p) where we can not change p is true but a is value at that pointer
so a reference is a value_at-cannot_be_changed_by_us-pointer
and is not a constant pointer


Post your comments here:

Your comments will be displayed after verification.