Pointer is a variable whose value is the address of the memory location. Pointers are the extra feature that makes C and Cpp still stand in the competitive market along Java and all other languages.
Pointers are used to store the address of another variable. In
Var = 50 , The address of Var =1001. this case , address of Var = 1001 is stored in Pointer ptr.
To access the value 50 through the pointer we can directly use *ptr. This mean it extracts the value stored in the address.
*ptr means , it gives the value stored in the address . ptr has the address of Var . so the value inside Var is displayed .
Syntax for declaring a pointer is :
data_type * pointer_variable_name;