What is the difference between pointer and reference?
Submitted by: AdministratorWhen 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.
Submitted by: Administrator
Example:
Syntax of reference:
<Type> & <Name>
int& rA = A; rA is a reference to int.
Submitted by: Administrator
Read Online C++ References Job Interview Questions And Answers
Top C++ References Questions
☺ | What is reference variable? |
☺ | What is output of this program? |
☺ | What is a local reference? |
☺ | What are References in C++? |
Top C Plus Plus Language Categories
☺ | C++ Pointers & Functions Interview Questions. |
☺ | C++ Operator Overloading Interview Questions. |
☺ | C++ Exception Handling Interview Questions. |
☺ | C++ Template Interview Questions. |
☺ | C++ Virtual Functions Interview Questions. |