The pointer is a special type of variable that is used to hold or store memory location (address) rather than value. Pointer can have any name that is legal for other variables and it is declared in the same fashion as other variables but is always denoted by an asterisk (*) operator.
FEATURES OF POINTER:
POINTER DECLARATION:
The declaration of the pointer variable is similar to a normal variable declaration but preceding with an asterisk (*) symbol.
Syntax:
Data_Type *Variable_Name;
Example:
int *ptr;
Here type of variable ptr is ‘pointer to int’ or (int *), or we can say that the base type of ptr is int.
INITIALIZATION OF POINTER VARIABLE:
Global and local static pointers are automatically initialized to NULL but when we declare an automatic pointer variable it contains garbage value i.e. it may be pointing anywhere in the memory. So, we should always assign an address before using it in the program.
Example:
int *ptr;
int num=26;
ptr=#