Answers for "how to call array in for loop"

0

arrays with for loops

int findSmallest(int[] values) {
  int minIndex = 0;  // start with 0th element as min
  for (int i=1; i<values.length; i++) {
    if (values[i] < values[minIndex]) {
      minIndex = i;
    }
  }
  return minIndex;
}
Posted by: Guest on May-15-2020

Code answers related to "how to call array in for loop"

Browse Popular Code Answers by Language