English Wikipedia - The Free Encycl...
הורד מילון זה
Dereference operator
The dereference operator or indirection operator, denoted by "*" (i.e. an asterisk), is a unary operator found in C-like languages that include pointer variables. It operates on a pointer variable, and returns an l-value equivalent to the value at the pointer address. This is called "dereferencing" the pointer. For example, the C code <source lang="C">
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 = ?  // & 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
</source> assigned 1 to variable x by using the dereference operator and a pointer to the variable x.

See more at Wikipedia.org...


© This article uses material from Wikipedia® and is licensed under the GNU Free Documentation License and under the Creative Commons Attribution-ShareAlike License