O'Reilly logo

From Java to C#: A Developer's Guide by Heng Ngee Mok

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

29.7. Using the * Indirection operator

Let's look at the third use of the * symbol in C#. You have seen * used:

  • as a binary multiplication operator (e.g. int x = 3*4;);

  • to denote a pointer referent type during declaration of a pointer type (e.g. long* pTemp; declares a pointer variable called pTemp of referent type long).

When applied on a single operand in unsafe codes, the * symbol becomes the indirection [14] operator.

[14] Indirection is also commonly called 'dereferencing'. These two terms are often used interchangeably in C/C++ literature.

The indirection operator is used to obtain the value of the variable to which the pointer points. It can only be applied to a pointer type with the exception of void*. Applying it to a non-pointer type ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required