A variable that contains the address of another variable or address of a memory location is called a pointer.
A pointer is also called a pointer variable.
A pointer variable can store address of other variables.
Pointer declaration and definition
In C language we know that all the variables should be declared before they are used, pointer variables should be declared before they are used.
Here, we see how to declare pointer variable.
Syntax:- data * identifier;
type can be any data type such as int, float, char etc.
*the asterisk( * ) in between type and identifier tell that the identifier is a pointer variables.
Identifier are name given to the pointer variable.
Steps to be followed while using pointers
Declare a data variable Ex:- int a;
Declare a pointer variable Ex:- int*p;
Initialize a pointer variable Ex:- p=&a;
Access data using pointer variable Ex:- printf("%d",*p);
Q) W.A.P to initialize pointer to variable
int a =25,b=34,sum;
int *pa, *pb;