& as type modifiers
int ideclares an int.
int* pdeclares a pointer to an int.
int& r = ideclares a reference to an int, and initializes it to refer to
C++ only. Note that references must be assigned at initialization, therefore
int& r;is not possible.
void foo(int i)declares a function taking an int (by value, i.e. as a copy).
void foo(int* p)declares a function taking a pointer to an int.
void foo(int& r)declares a function taking an int by reference. (C++ only)
& as operators
foo(int). The parameter is passed as a copy.
foo(*p)dereferences the int pointer
foo(int)with the int pointed to by
foo(&i)takes the address of the int
foo(int*)with that address.
(tl;dr) So in conclusion, depending on the context: