Walk the array once. Keep the largest value seen so far.
To find a maximum you walk the row once and remember the biggest value you have seen so far. You do not need to sort. One pass is enough.
first
update
no
no
Each step highlights the matching C line. Program output appears only when a line that prints actually runs.
Five questions. Pick one answer each, then Check answers. The correct choice turns green.
1. Sample max is:
8 is largest.
2. mx starts as:
Need a real starting value.
3. Update mx when:
Strictly greater.
4. This scan is:
Linear scan.
5. If the array were 2-D marks[students][subjects], max would use:
Nested for.