Pointer is a special variable that stores address of another variable
Addresses are integers. Hence pointer stores integer data
Size of pointer = size of int
Pointer that stores address of integer variable is called as integer pointer and is declared as int *ip;
Addresses are integers. Hence pointer stores integer data
Size of pointer = size of int
Pointer that stores address of integer variable is called as integer pointer and is declared as int *ip;
Pointers that store address of a double, char and float are called as double pointer, character pointer and float pointer respectively.
char *cp
float *fp
double *dp;
Assigning value to a pointer
int *ip = &a; //a is an int already declared
char *cp
float *fp
double *dp;
Assigning value to a pointer
int *ip = &a; //a is an int already declared
Example
int a;
a=10; //a stores 10
int *ip;
ip = &a; //ip stores address of a (say 1000)
ip : fetches 1000
*ip : fetches 10
* Is called as dereferencing operator
int *ip;
ip = &a; //ip stores address of a (say 1000)
ip : fetches 1000
*ip : fetches 10
* Is called as dereferencing operator