The method findMax shown below is supposed to return the position of the largest value in the portion of an array between 0 and last, inclusive:
```
int findMax(int array[ ], int last)
{
int maxPos = 0;
for (int k = 1; k <= last; k++)
{
// Code is Missing
}
return maxPos;
}
```
The missing code is
A) if (array[k] > maxPos) return maxPos;
B) if (array[k] > array[maxPos]) return maxPos;
C) if (array[k] > array[maxPos]) maxPos = k;
D) if (array[k] > array[maxPos]) k = maxPos;
C) if (array[k] > array[maxPos]) maxPos = k;
You might also like to view...
If the condition of a for loop is false, then the flow is directed around the statements within it, and then redirected back to the condition, restarting the cycle.
Answer the following statement true (T) or false (F)
Stackingan element takes that element out of the normal flow of the document and positions it along the left or right edge of its containing element. ?
Answer the following statement true (T) or false (F)