A helper can choose. Return the larger of two ints.
max2(a, b) returns whichever of two ints is larger. 3 and 9 go in, 9 comes out. Choosing is still a function — it just uses if instead of multiply.
a
b
no
9
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. max2(3,9) is:
b is larger.
2. The false branch of a > b returns:
return b.
3. Ternary form is:
Same choose.
4. To max three numbers you could:
Compose helpers.
5. void max2 would be a problem if:
Need a return value.