pointer:
A pointer is a variable which contains the address in memory of another variable. We can have a pointer to any variable type.
The indirection or difference operator * gives the contents of an object pointed to by a pointer.
The unary or monadic operator & gives the address of a variable.
To declare a pointer to a variable do:
syntax:
int *pointer;
Example :
#include<stdio.h>
#include<conio.h>
void main( )
{
int i;
clrscr( );
printf("The value of the i is :",*i);
getch();
}
OUTPUT:
The value of the i is : 1053
Explanation :
Here the output will be 1053 because it shows the output as it address,not it's value.
int *pointer;
Example :
#include<stdio.h>
#include<conio.h>
void main( )
{
int i;
clrscr( );
printf("The value of the i is :",*i);
getch();
}
OUTPUT:
The value of the i is : 1053
Explanation :
Here the output will be 1053 because it shows the output as it address,not it's value.