C++ Syntax: Address: &

Description

& is the unary address operator. When applied to a variable or object it returns its address, a value that can be stored in a pointer. For example:-
Int_t   my_int = 2;
Int_t  *my_int_ptr =&my_int;
my_int_ptr holds a pointer to my_int.

See operator precedence

Other Uses for &

When an & appears after a type name (either a basic data type or a class) it means that the type is a reference to that type, as in the declaration:-
Int_t  &my_int =  *your_int;
For a discussion of references, see Pointers & References.

Usage Notes

None.
Go Back to the The C++ Crib Top Page


If you have any comments about this page please send them to Nick West