C++ - Pointer vs Reference
This table comes from Back to Basics: Forwarding References - How to Forward Parameters in Modern C++ - Mateusz Pusz 2023
| POINTER | REFERENCE |
|---|---|
| Objects | Alias (not an object) |
| Always occupy memory | May not occupy storage |
| Arrays of pointers are legal | No arrays of references |
| Pointers to pointers legal | References or pointers to references not allowed |
Pointers to void legal |
No references to void |
| May be uninitialized | Must be initialized |
| Can be reassigned after initialization | Immutable |
| Can be cv-qualified | Can’t be cv-qualified |