Monday, 4 November 2013

An Introduction Of POINTER In C

POINTER NOTATION :-


  •   Consider the declaration 

              int i =3;

  • This declaration tell c compiler to :-
  1. Reserve space in memory to hold the integer value.
  2. Associate the name i with this memory location .
  3. State the value 3 at this location .
                                  i----------------->location name
                        -------------------->value at location 
                            65524--------------------------------->location number
 void main()
 {

   int i=3;
  printf("\n Address of i=%u",&i);
  printf("\n value of i=%d",i);
  print("\n value of i=%d",*(&i));

 }

    OUTPUT :-
   Address of i=65524
   value of i=3
   value of i=3


  • The '&' used in theis statement is c's address of operators.The expression '&i ' retures the address of variable i,which in this case happens to be 65524.
  • The other pointer available in C is '*, called value at address operator.its gives the value stored at a particlar address .The 'value at address' operator is also called 'Indirectional operator' .

No comments:

Post a Comment