Dereference operator

The dereference operator or indirection operator, denoted by "*" (i.e. an asterisk), is a unary operator found inC-like languages that include pointer variables. It operates on a pointer variable, and returns an l-valueequivalent to the value at the pointer address. This is called "dereferencing" the pointer. 

For example, the C code":

 int x;
 int *p;  // * is used in the declaration:
          // p is a pointer to an integer, since (after dereferencing),
          // *p is an integer
 x = 0;
 // now x == 0
 p = &x;  // & takes the address of x
 // now p == &x, so *p == x
 *p = 1;  // equivalent to x = 1, since *p == x
 // now *p == 1 and *p == x, so x == 1

Comments

Popular posts from this blog

Umbrella activities in Software Engineering

Operating System | Best Definition of Opetating System