My rule of thumb is:
Use pointers if you want to do pointer arithmetic with them (e.g. incrementing the pointer address to step through an array) or if you ever have to pass a NULL-pointer.
Use references otherwise.
More Related Contents:
- Why can’t I do polymorphism with normal variables?
- What are the differences between a pointer variable and a reference variable in C++?
- When to use references vs. pointers
- When should I use the new keyword in C++?
- What is a reference variable in C++?
- C++ pass an array by reference
- C++ standard: dereferencing NULL pointer to get a reference? [duplicate]
- How are references implemented internally?
- difference between a pointer and reference parameter?
- how does the ampersand(&) sign work in c++? [duplicate]
- What are the differences between a pointer variable and a reference variable?
- Passing references to pointers in C++
- Difference between pointer to a reference and reference to a pointer
- What’s the meaning of * and & when applied to variable names?
- Function pointer vs Function reference
- What is the difference between std::reference_wrapper and a simple pointer?
- Difference between const. pointer and reference?
- Confusion about pointers and references in C++
- Returning non-const reference from a const member function
- C++: difference between ampersand “&” and asterisk “*” in function/method declaration?
- Why do some people prefer “T const&” over “const T&”?
- dereferencing a pointer when passing by reference
- Why isn’t operator overloading for pointers allowed to work?
- C++ strings: [] vs. *
- Why is a c++ reference considered safer than a pointer?
- What is the proper way to return an object from a C++ function?
- Pass by pointer & Pass by reference [duplicate]
- Reference to a pointer
- Literal initialization for const references
- Both asterisk and ampersand in a parameter