The indirection operator (*) accesses a value indirectly, through a pointer. The operand must be a pointer value. The result of the operation is the value addressed by the operand; that is, the value at the address to which its operand points. The type of the result is the type that the operand addresses.
For related information, see Address-of Operator.
Example
In the following example, the pointer pSomething
is assigned the address of nSomething.
The indirection operator then assigns the value of 15
to nSomething
. The result is that the variable nSomething
now contains the value of 15.
// Example of the indirection operator
int nSomething;
int *pSomething; // define pointer
pSomething = &nSomething; // assign address
*pSomething = 15;