Back In the print window choose "Save as PDF" as the destination
NOTE.CS

Reference vs Pointer

1 topic ยท 28 Nov 2026
1

Reference vs Pointer

C++

A reference is another name (alias) for an existing variable.

C++
int x = 10;
int &r = x;   // r is another name for x
r = 50;
cout << x;    // 50
ReferencePointer
Must be initialised when declaredCan be declared without a value
Cannot be nullCan be nullptr
Cannot be changed to refer to another variableCan point to another address later
No special syntax to access (r)Needs * to access (*p)