While a pointer pointing to a variable provides an indirect access to the value of the variable stored in its memory address, the indirection operator references the pointer and returns the value of the variable at that memory location. The indirection operator is a unary operator represented by the symbol (*).
- * is an indirection operator
- It is also known as Deferencing operator
- It is an unary operator
- It takes address as an argument.
- * returns the content/container whose address is it's argument.
It’s the asterisk (‘
*
’) operator. So, if you have a pointer:
- int x;
- int *p = &x;
you can set
x
indirectly through p
this way:
- *p = 5;
The unary
*
operator, applied to a pointer, is the indirection operator. This is not to be confused with the binary *
operator, which means multiplication.
No comments:
Post a Comment