August 2002
Beginner
1122 pages
22h 1m
English
| 1. | The correct answer is: “Who knows?” If you said “30”, you forgot that the loop variable values are from 0 through 4, rather than from 1 through 5. On the other hand, if you said “20”, you had the right total of the numbers 0, 2, 4, 6, and 8, but didn't notice that the variable Result was never initialized. Of course, adding anything to an unknown value makes the final value unpredictable. Many current compilers, unfortunately not including the one on the CD in the back of this book, are capable of warning you about such problems. If you're using a compiler that supports such warnings, I recommended that you enable them because that is the easiest way to find such errors, especially in a large program. Unfortunately, a compiler ... |
Read now
Unlock full access