113. Searching and Sorting-I

Question.7

A developer calls a find-max function on an empty ADC buffer (no samples yet):

int find_max(int arr[], int n) {
   int max = arr[0];
   for (int i = 1; i < n; i++) {
       if (arr[i] > max) max = arr[i];
   }
   return max;
}

int result = find_max(adc_buf, 0);  // n = 0

What happens?

Need Help? Refer to the Quick Guide below

Select Answer