[WEBINAR] Bulletproof: How Today's Business Leaders Stay on Top

Address-of Operator (&)

Definition - What does Address-of Operator (&) mean?

An address-of operator is a mechanism within C++ that returns the memory address of a variable. These addresses returned by the address-of operator are known as pointers, because they "point" to the variable in memory.

The address-of operator is a unary operator represented by an ampersand (&). It is also known as an address operator.

Techopedia explains Address-of Operator (&)

Address operators commonly serve two purposes:

  1. To conduct parameter passing by reference, such as by name
  2. To establish pointer values. Address-of operators point to the location in the memory because the value of the pointer is the memory address/location where the data item resides in memory.

For example, if the user is trying to locate age 26 within the data, the integer variable would be named age and it would look like this: int age = 26. Then the address operator is used to determine the location, or the address, of the data using "&age".

From there, the Hex value of the address can be printed out using "cout << &age". Integer values need to be output to a long data type. Here the address location would read "cout << long (&age)".

The address-of operator can only be applied to variables with fundamental, structure, class, or union types that are declared at the file-scope level, or to subscripted array references. In these expressions, a constant expression that does not include the address-of operator can be added to or subtracted from the address-of expression.

This definition was written in the context of C++
Share this:

Connect with us

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.