Pointer conversions
Pointer conversions are performed when pointers are used, including pointer assignment, initialization, and comparison.
Conversions that involve pointers
must use an explicit type cast. The exceptions to this rule are the
allowable assignment conversions for C pointers. In the following
table, a const-qualified lvalue cannot be used as
a left operand of the assignment.
| Left operand type | Permitted right operand types |
|---|---|
pointer to (object) T |
|
pointer to (function) F |
|

- Zero constant to null pointer
- An integral constant expression that evaluates to zero is a null pointer constant. This expression can be converted to a pointer. This pointer is a null pointer (pointer with a zero value), and is guaranteed not to point to any object.
- Array to pointer
- An lvalue or rvalue with type "array of N," where N is
the type of a single element of the array, to N
*. The result is a pointer to the initial element of the array. This conversion is not performed if the expression is used as the operand of the address operator&or thesizeofoperator
or when the array is bound to a reference of the array type
. - Function to pointer
-
An lvalue that is a function can be converted to a
(prvalue)
rvalue that is a pointer
to a function of the same type, except when the expression is used
as the operand of the &(address) operator, the()(function call) operator, or thesizeofoperator.