Indirection Or Deference Operator(*)
Once the
pointer variable stores the address of some variable, it can be used to
indirectly access the value of the variable whose address is stored in it. For
this, simply precede the pointer variable with an indirection operator(*). It
is also known as dereference operator as it returns the value of the variable
pointed to by the pointer variable.
Program
that demonstrates the use of dereference operator(*).
#include<stdio.h>
#include<conio.h>
void main()
{
int i=5,*ptr;
clrscr();
ptr=&i;
printf(“\n value stored at address
of ptr=%d”,*ptr);
getch();
}
Output:
value stored at
address of ptr= 5
Post a Comment