C pointer Address operators

There are two important operators which are highly required, if you are working with the pointers. Without these operators, we cannot work with the pointers.

The operators are:

The * Operator (Dereference Operator or Indirection Operator)

The & Operator (Address Of Operator)

1) The * Operator (Dereference Operator or Indirection Operator)

"Dereference Operator" or "Indirection Operator denoted by asterisk character (*), * is a unary operator which performs two operations with the pointer (which is used for two purposes with the pointers).

To declare a pointer

To access the stored value of the memory (location) pointed by the pointer

A) To declare a pointer

Consider the syntax

data_type *pointer_variable_name;

Let suppose, if we declare a pointer ptrX to store the memory address of an integer variable; then the pointer declaration will be int *ptrX;

B) To access the stored value of the memory (location) pointed by the pointer

Consider the syntax

*pointer_variable_name;

Let suppose, if there is a pointer variable ptrX which is pointing to the address of an integer variable x; then to access the value of x, *ptrX will be used.

2) The & Operator (Address Of Operator)

The "Address Of" Operator denoted by the ampersand character (&), & is a unary operator, which returns the address of a variable.

After declaration of a pointer variable, we need to initialize the pointer with the valid memory address; to get the memory address of a variable Address Of" (&) Operator is used.