Answer:
Pointer variables declaration: Pointer variables are used to store
the address of the variable. And a pointer variable can store only the address
of the variable which has the same data-type as the pointer variable.
data-type
*pointer-variable name;
Example:
int
*ptr;
In the above example we have declare
the pointer variable with the name of ‘ptr’ and its data-type in int, that means
it can store the address of the variable which is of integer type.
Initialization of pointer variables: The
initialization of the pointer variable is simple like other variable but in the
pointer variable we assign the address instead of value.
Example:
int
*ptr,var1;
ptr=&var1;
Here in the above example we have a
pointer variable and another is a simple integer variable and we have assign
the pointer variable with the address of the ‘var1’. That means the pointer
variable ‘ptr’ is now has the address of the variable ‘var1’.
If we want to access the pointer
variable then we have to understand the most important thing which is as
follows:
If the ‘*’ asterisk sign is before
the pointer variable this means the pointer variable is now pointing to the value
at the location instead of the pointing to location.