|
Answer» A POINTER DIFFERS from a reference in the following ways:
- In the case of reference, an object must always be referred while initializing. On the contrary, such restrictions are not MEANT for pointers.
- The different types of objects can be pointed by the pointers by reassigning the pointers with different objects. On the contrary, in a reference, the same object which was initialized earlier can only be referred by a reference.
- You can USE a null ADDRESS in a pointer parameter to indicate that a variable does not exist; whereas, there is no existence of a null reference in C++.
- A reference usually appears outside an object; whereas, a pointer generally appears inside an object.
A pointer differs from a reference in the following ways:
|