Course Content
C Basics
C Basics
References and Dereferences
The concept of pointers is based on two unary (one-character) operators:
- reference operator
&
; - dereference operator
*
.
Reference operator
This operator allows us, literally, to feel the RAM of our computer. The &
operator allows you to get the actual address of an object.
Main.c
Note
%p
is a specifier for addresses (pointer).
The object address is written in hexadecimal notation:

The &
operator recognizes your address from your name.

Dereferences operator
On the contrary, the *
operator returns the name of the house's owner at his address. But how can we use this operator when not directly working with addresses? The &x
expression returns the address of the x
variable, if you use the *
operator on the &x
expression, then we will get the value of the variable that is hidden behind this address:
Main.c
Note
Do not confuse the dereference operator (
*x
) with the multiplication operator (x*y
).
Task
- Create an integer array with 5 elements and fill it.
- Return the address of the third element.
- Add one to the address of the third element (address + 1).
- Try to dereference the address received in the 3rd task
Everything was clear?