A pointer is a variable that holds a
memory address. That’s it.
This is what the difference in between
variable and pointer.
◦ Pointer holds the address
◦ Variable holds the value.
Computer memory is divided into
sequentially numbered memory locations.
Each variable is located at a unique location
in memory, known as its address.
Thecapability to use pointers and
manipulate memory at a low level
is one of the factors that makes
C++ the language of choice for
embedded and real-time
Different computers number this memory
using different complex schemes.
We must happy, as a programmer, We don’t
need to know the particular address of any
given variable because the compiler handles
If we want this information, though, you can
use the address-of operator (&), which
returns the address of an object in memory.
It is so simple to declare a pointer. We need
the type of the pointer
Next the name of the pointer.
When we declare a pointer variable such as
pointer, the compiler sets aside enough
memory to hold an address
A pointer that is not initialized is called a wild
pointer because you have no idea what it is
If you want to initialize you can as like we do
for variable. int *intPointer = 0;
A pointer whose value is zero is called a null
All pointers, when they are created, should be
initialized to something.
Every variable has an address. Even without
knowing the specific address, you can store a
variable’s address in a pointer.
Declaring pointer Passing address
Type must be same to the variable whose
address is going to pass to the pointer.
When you want to pass the address of the
variable use (&) before the variable name.
When you want to pass the value use (*)
before the pointer.