There are two pointer operators :
1. value at address operator ( * )
2. address of operator ( & )
The * is a unary operator. It gives the value stored at a particular address. The ‘value at address’ operator is also called ‘indirection’ operator.
q = *m;
if m contains the memory address of the variable count, then preceding assignment statement can places the value of count into q.
The & is a unary operator that returns the memory address of its operand.
m = & count;
The preceding assignment statement can be “The memory address of the variable count is places into m”.
\* Pointer to initialize and print the value and address of variable. *\
# include < stdio.h >
int main( )
{
int a = 25 ;
int *b ;
b = &a ;
printf("\n Address of a = %u ", & a) ;
printf("\n Address of a = %u ", b) ;
printf("\n Address of b = %u ", & b) ;
printf("\n Value of b = %u ", b) ;
printf("\n Value of a = %d ", a) ;
printf("\n Value of a = %d ", *( &a ) )) ;
printf("\n Value of a = %d ", *b) ;
return ( 0 );
}
Address of a = 12345
Address of a = 12345
Address of b = 12345
Value of b = 12345
Value of a = 5
Value of a = 5
Value of a = 5