What is a pointer in C++, and how is it different from a reference?
Show answer and explanation
A pointer is an object that stores an address; it can be null, reseated, copied, and, for array elements, used in pointer arithmetic. A reference is an alias bound during initialization and cannot later be reseated; ordinary references must denote a valid object or function whenever used. Neither form implies ownership by itself, so ownership must be expressed separately, preferably with RAII types.
A pointer is an object that stores an address; it can be null, reseated, copied, and, for array elements, used in pointer arithmetic. A reference is an alias bound during initialization and cannot later be reseated; ordinary references must denote a valid object or function whenever used. Neither form implies ownership by itself, so ownership must be expressed separately, preferably with RAII types.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.