Loading
369 views
What does the ampersand mean
Page 1
1–2
& (ampersand) gives you the address of the variable (instead of the value). For example:
int i = 22 ;
int* ptr = &i ;
cout << "catch " << i << endl ; // no pointer magic necessary
cout << "catch " << *ptr << endl ; // using pointer magic
Notice the * operator, which is the conjugate of *, it says "give me the value at the address".
& is usually called the "address operator"
* is usually called the "dereference operator"
Page 1
1–2