0
void search(int array[] , int length)
{ 
  int  min = 0;
   while (min <= length-1)
   {
      int index = min+1;   
      if array[min] >= array[index]
      {      

         min  = index; 
         min++;
         index++;   
         else if ((index == length-1))                                    
         {
             min++;
             index = min+1;
         }
         else                                
         {
            index++;
         }

    printf ("%d", array[min]";
    return;
     }
 }
}
1
  • Haven't you tested your code? Maybe print out the sorted list to see if the target is present? Please review the following link, particularly the sections on naked code drops and code reviews.
    – Cliff B
    Commented Aug 27, 2017 at 22:24

1 Answer 1

0

In short, no, it won't work. It may or may not find the target in the list, but since it returns void, i.e., it doesn't return anything, it will never say if it found something or not.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .