Search This Blog

Translate

c program to find smallest element in an array using pointers



#include
#include
void main()
{
  int arr[5]={2,5,3,0,-1};
  int i,min;
  clrscr();
  min=*arr;
  for(i=0;i<5 br="" i="">  {
    if(min>*(arr+i))
      min=*(arr+i);
  }
  printf("Smallest value in array:%d",min);
 getch();
}

C Program example List

Google+ Badge