Pointers vs reference

+1 preona brijmohan · July 11, 2015
What are the advantages and disadvantages of pointers over reference in c++ ?

I've been searching the web but haven’t been able to find distinct differences.

Some help shall be appreciated :)

Post a Reply


Oldest  Newest  Rating
0 Michael Bradford · July 11, 2015
They are the same thing technically. Basically a reference can't be reassigned to a different memory address like a pointer can, because of that you can't move it one byte of memory and step through and array directly using memory addresses. A pointer can be assigned a NULL while a reference must reference something. 

A reference is just an easy way of using a pointer without all the pitfalls and without some of the control, if your just passing variables use references, in fact as a general rule of thumb if you can use a reference without needing the control of a pointer don't use a pointer.

But again to clarify references are just pointers with some restrictions so that you can harness common needs of pointers without worrying and taking care of pointer pitfalls.
0 preona brijmohan · July 11, 2015
Thank you very much Michael ! :)
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator