Rencontre du troisième type

Les références par l’exemple

int main(){
	int a = 10;
	int &ref = a; // ref "pointe" sur a
	cout << ref << endl; // affiche 10
	return 0;
}

Exemple sur paramètres de fonctions

void swap(int *a, int *b) {
	int c = *a;
	*a = *b;
	*b = c;
}
// ...
int a=10, b=42;
swap(&a, &b);
void swap(int &a, int &b) {
int c = a;
a = b;
b = c;
}
// ...
int a=10, b=42;
swap(a, b);

Le mot-clé auto