194k views
1 vote
Combining function calls The function max, dened below, determines the greatest of its two integer arguments. int max(int a, int b) { return(a < b ? b : a) }

1 Answer

4 votes

Final answer:

The question is about how to use the 'max' function in programming to find the greatest integer among its arguments, using nested function calls if comparing more than two numbers.

Step-by-step explanation:

The student is asking about the use of a specific function in programming which determines the maximum of two integers. The function is int max(int a, int b), and it uses a ternary operator to return the greater of the two integer values. When combining function calls, one can nest calls to the max function within each other to compare more than two numbers.

For example, to find the greatest number out of three, a, b, and c, one might write the call as max(max(a, b), c). Here, the inner call max(a, b) determines the greater of a and b, and then the outer call compares that result to c to find the overall maximum.

User Count Chocula
by
8.1k points