REALLY basic functions problem

declare the variable MIN_local locally at the start of the function

(your if-clause in the function read if (a[i]< MIN) { - can you spot the error)



int getMIN() {

  // declare the variable locally at the start of the function 
  int MIN_local=11000; 

  for (int i=0; i<a.length; i++) {
    if (a[i] < MIN_local) {
      MIN_local = a[i]; 
    }//if
  }//for
  return MIN_local;
}//function
1 Like