- In some respects, a pointer is just a type of variable.
However, it's a very different type of variable.
For starters,
it is a variable used to store an address in memory.
It reminds us that C is not just a high-level language
as its evident from working with it so far,
but also allows us to manage memory
directly in ways that are very, very sophisticated
and you really need to be careful
because you can access things that could cause damage
if inappropriately used
or make as a program to work incorrectly.
Let's look at some declaration
that are possible for a pointer.
Because a pointer stores an address,
it has to point to a particular type of data.
This is an example of a pointer
that can store an address of an int.
This pointer, letter, stores an address of a char.
This one the address of a double.
Note the star that precedes the pointer.
This star is always an indicator that the variable
is actually a pointer.
Let's see how this looks in a C program,
which is identical to that.
In this program, we have the same exact variables,
pointer and letter and price.
The same rules that you used to name your variables,
the same location you used to place your variables
and declares them, still hold for pointers.
The only difference is the star
in the front of the pointer definition,
and the fact that you have to remember that every pointer
can only point to the address
that was used when it was defined.
We will now gradually learn more about pointers
and see what are they good for and why they're so important.