Pointer (C++) : Prepared By: Irfan Ahmed
Pointer (C++) : Prepared By: Irfan Ahmed
Only one thing can remain constant and that is nothing. ( iffi )
Pointer
Variable that stores the memory address
Reference operator (&) is used to access the memory
address of a variable and stores it into the pointer.
Syntax:
o Data type * variable ;
o Such as
• int * a ;
}
Dereference Operator ( * )
It is used to access the value of the variable whose
memory address is stored in the pointer.
“*” is also called indirection operator
example
Output of the program using Dereference
Operator
Use of Pointer in Structure and
Function
Dot operator is not used to access the members of
structure when we use pointer to refer a structure
variable.
In this case, we use selection operator “ -- > ” to
access the structure members.