-
Pointers can be reassigned and can have NULL as a value. They can also simulate arrays. Your alternative, the reference variable, cannot be reassigned and can not have NULL as a value, but removes a lot of the syntax involved in pointers. References are safer to use, but they do not completely replace pointers.
One reason they don't replace pointers is because references are aliases for variables and not really types like pointers are. You cannot use a reference type in a std::vector for example. Another reason they don't replace pointers is because memory is not managed in C++ like in other languages; otherwise, a reference would be all you would need. Under the hood of just about any useful object are pointers allocated with new and so forth. So when you are using pointers, most of the time it is because there is no other choice.
-
Thanks to nadroj, your posts are a gentle reminder of the basic concepts :)