C++ References Question:
Download Job Interview Questions and Answers PDF
What is the difference between pointer and reference?
Answer:
When a reference is created, it can’t reference another object. This can be done with pointers. References cannot be null whereas pointers can be. References cannot be uninitialized and it is not possible to refer directly to a reference object after it is defined.
Example:
Syntax of reference:
<Type> & <Name>
int& rA = A; rA is a reference to int.
Example:
Syntax of reference:
<Type> & <Name>
int& rA = A; rA is a reference to int.
Download C++ References Interview Questions And Answers
PDF
Previous Question | Next Question |
What means pass by value? | Which reference modifier is used to define reference variable? a) & b) $ c) # d) none of the mentioned |