The Pointer is the special kind of
variable , which is capable of storing the address of the another variable.
The general form of declaring the
pointer variable is ,
datatype *pointername;
Consider the following statements ,
int a=5;
This statment will declare the
pointer variable with the name , a and is capable of storing the value of an integer .This
statement will intialise the variable a with the value 5.
int *p;
p=&a;
int *p;
This statement will declare the
pointer to an integer , that is , the pointer variable capable of storing the address of an
integer type variable.
p=&a;
& operator(Ampersand) is
also known as "Address Of" operator and is used to access the address of a
variable.
*p
* (Asteriek) Operator is also
kown as "Value At Address" operator and is used to access the value stored at a particular
address.
*p ==> *(1000) ==> Value
at Address 1000 ==> 5
No comments:
Post a Comment