References in C++

References are aliases for other variables. Once assigned, they cannot be changed.

int a = 5;
int& ref = a;
ref = 10;

cout << a; // Output: 10

References are commonly used in function parameters to avoid copying large objects.

← PrevNext →