Ask Question

During testing, a student receives the incorrect answer back from a function that was supposed to be designed to return the largest value found in an array of double values provided as a parameter. Read the function definition used for this purpose, and identify the error:

int findMax (double arr [ ], int s)

{

int i;

int indexOfMax = 0;

double max = arr[0];

for (i=1; i < s; i++)

{

if (arr[ i ] > arr [indexOfMax])

{

indexOfMax = i;

max = arr[indexOfMax];

}

}

return indexOfMax;

}

+5
Answers (1)
  1. 10 June, 18:35
    0
    dude what r u doin
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “During testing, a student receives the incorrect answer back from a function that was supposed to be designed to return the largest value ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers