Dereferencing operator ('*')

Previous Unary operators Next

In the expression

* expr
which means "the object pointed to by expr", the expr must have type "pointer to type," where type is any data type. The result of the indirection is of type type.

If the operand is of type "pointer to function", the result is a function designator. If the operand is a pointer to an object, the result is an lvalue designating that object.

In the following situations, the result of indirection is undefined:
  1. The expr is a null pointer.
  2. The expr is the address of an automatic (local) variable and execution of its block has terminated.
You can also use the asterisk as an operator to dereference a pointer, or as the multiplication operator. Asterisk may be used also as a punctuator for creating pointer types.