0

reference VS pointer variables

what is the the difference between reference variables (from C++) and pointer variables (from C)?

13th Aug 2016, 5:31 PM
Mehak Kapil
Mehak Kapil - avatar
4 Answers
0
C++ has pointers too... Pointers can point basically anywhere. Reference variables always point to a specific object. Once you get into using structures and stuff you'll understand this more.
13th Aug 2016, 5:53 PM
Corey Iles
Corey Iles - avatar
0
okie.... thanQ :)
13th Aug 2016, 5:55 PM
Mehak Kapil
Mehak Kapil - avatar
0
As a tipp: try to use reference wherever possible as they tend to produce less memory errors and still provide polymorphism as pointers.
13th Aug 2016, 8:46 PM
Stefan
Stefan - avatar
0
References (&) can't be assigned to other variables/objects and must be initialised; pointers are happy to be null and reassigned.
14th Aug 2016, 1:13 AM
Ahkrin