Logic of Function maximum

To determine the maximum value (lines 60–73 of Fig. 6.3), we begin with the assumption that parameter x contains the largest value, so line 62 of function maximum declares local variable maximumValue and initializes it with the value of parameter x. Of course, it’s possible that parameter y or z contains the actual largest value, so we must compare each of these values with maximumValue. The if statement in lines 65–66 determines whether y is greater than maximumValue and, if so, assigns y to maximumValue. The if statement in lines 69–70 determines whether z is greater than maximumValue and, if so, assigns z to maximumValue. At this point the largest of the three values is in maximumValue, so line 72 returns that value to the call in line 56. When program control returns to the point in the program where maximum was called, maximum’s parameters x, y and z are no longer accessible to the program.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.211.239