2. 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.
3. Computer memory is divided into
sequentially numbered memory locations.
Each variable is located at a unique location
in memory, known as its address.
Memory representation
4. 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
applications.
5. 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
the details.
If we want this information, though, you can
use the address-of operator (&), which
returns the address of an object in memory.
6.
7. 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
int *pointer;
8. A pointer that is not initialized is called a wild
pointer because you have no idea what it is
pointing to.
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
pointer.
All pointers, when they are created, should be
initialized to something.
9. 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
11. 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.