- The answers are
a. False
b. True
c. True
d. False
e. True
Exercises ........................................................................................................
- The following is one possible answer:
if (x > y)
x = y;
else // y > x || y == x
y = x; - See exercise 3.
- Entering 20 , 10 , 50 gives back a: 20,b: 30,c: 10.
Line 14 is assigning, not testing for equality. - See Exercise 5.
- Because line 6 is assigning the value of a-bto c, the value of the assignment is a
(2) minus b(2), or 0. Because 0 is evaluated as false, the iffails and nothing is
printed.
Day 5....................................................................................................................
Quiz ................................................................................................................
- The function prototype declares the function; the definition defines it. The proto-
type ends with a semicolon; the definition need not. The declaration can include
the keyword inlineand default values for the parameters; the definition cannot.
The declaration need not include names for the parameters; the definition must. - No. All parameters are identified by position, not name.
- Declare the function to return void.
- Any function that does not explicitly declare a return type returns int. You should
always declare the return type as a matter of good programming practice. - A local variable is a variable passed into or declared within a block, typically a
function. It is visible only within the block.
826 Appendix D
32 0672327112_app_d.qxd 11/19/04 12:30 PM Page 826