← BYTES
C++·Starter·Ref: 8.1.11
What is the difference between a reference and a pointer in C++?
Have a question about this video? Mention reference 8.1.11 when you contact us.
a.They are completely interchangeable with no differences
b.A reference must be bound to a valid object at creation and can never be reseated to refer to something else; a pointer can be reassigned to point elsewhere, or set to null
c.References can be null, pointers cannot
d.Pointers cannot be used in C++, only references
A reference is essentially an alias for an existing object -- once bound, it always refers to that same object. A pointer is a separate, reassignable variable holding an address, which can be changed to point elsewhere or set to nullptr, flexibility a reference deliberately lacks.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES8111#C