title: finding larger number using dynamic memory allocation
body: <p>Writing a program to find largest number using dynamic memory allocation. I have<br>
      written the             following code, there is some problem in<br>
      sorting part I am doing selectin sorting by    pointers . but
      sorting    is not not done    properly .....can we do selection
      sort by    pointers am I applying    right
      approach?   </p>
  
  <pre><code>         #include&lt;stdio.h&gt;
           #include&lt;stdlib.h&gt;  
           main()
           {
  
              int i,j,n,temp;
              int *data;
              printf("enter total no of elements:");
              scanf("%d",&amp;n);
              data=(int*)calloc(n,sizeof(int));
              printf("\n");
              for(i=0;i&lt;n;i++)
              {
                           printf("enter number %d:",i+1);
                           scanf("%d",data+i);
              }
             for(i=0;i&lt;n;i++)
             {
                     printf("%d\t",*(data+i));
              }
             printf("\n");
             for(i=0;i&lt;n;i++)
             {
                     for(j=i+1;j&lt;n;j++)
                 {
                         if(*(data)&gt;*(data+j))
                     {
                          temp=*(data);
                          *(data)=*(data+j);
                          *(data+j)=temp;
                      }
                 }
  
  
              }
              for(i=0;i&lt;n;i++)
              {
                   printf("%d\t",*(data+i));
              } 
              printf("largest element is %d\t",*(data+n-1));
           } 
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>         enter total no of elements:5
  
           enter number 1:2
           enter number 2:10
           enter number 3:12
           enter number 4:1
           enter number 5:0
           2  10  12  1   0   
           0  10  12  2
  </code></pre>