1.

How A Pointer Differs From A Reference?

Answer»

A POINTER DIFFERS from a reference in the following ways:

  1.  In the case of reference, an object must always be referred while initializing. On the contrary, such restrictions are not MEANT for pointers.
  2. 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.
  3. 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++.
  4.  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:



Discussion

No Comment Found