Wednesday, 27 November 2013

To sort of array using pointer


#include<conio.h>
#include<stdio.h>

    int main (void)
{
                      clrscr();
                     int item[100];
                     int a,b,t;
                     int count;
                    printf("\nHow many number ?");
                    scanf("%d",&count);
                   for(a=0;a<count;a++)
                      scanf("%d",&item[a]);
                  for(a=1;a<count;++a)
                     for(b=count;b>=a;--b)
                       {
                                if(item[b-1]>item[b])
                               {
                                    t=item[b-1];
                                   t=item[b-1]=item[b];
                                   item[b]=t;
                                    }
                         }
                      for(t=0;t<count;t++)
                     return 0;     
}
OUTPUT



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' .