C Programming Errata
Updates and Corrections
Last updated January 2, 2025
- Page 26
- The command to compile at the command prompt specifies the
-c
switch. This switch isn't necessary to build a program and you can omit it. The-c
switch directs the compiler to compile only; the object code isn't linked to create a program. While the-c
switch has its purposes, it's unnecessary to type at the command prompt when building the programs listed in the book. - Page 61
- In the sample code (center of the page), it should read
is a float
notis an float
. - Page 64
- In the fourth paragraph, the
%d
placeholder represents a decimal integer, not a floating-point value. - Page 72
- At the top of the page, character value
'a'
is placed into char variablec
. The code does not use a variablea
. - Page 85
- In the paragraph below Exercise 7-2, the first sentence refers to Exercise 7-2, not Exercise 7-1.
- Page 117
- In the paragraph starting "exit_condition", the statements continue to loop until the exit condition is false. In other words, the statements repeat while the exit condition is true. I apologize for the confusion.
- Page 291
- In Listing 19-4, the production team left some tags in the code that don't belong:
<SPiSymbol>
. Please ignore these tags. Listing 19-4 appears cleanly here on the web. - Page 299
- At the end of the first paragraph,
**(fruit+1)
is repeated. The sentence should read: "Subsequent strings' first characters would be**(fruit+1)
,**(fruit+2)
, and so on." The figure on this page (Figure 19-2) is a bit misleading; the asterisk isn't required beforefruit[]
. - Page 303
- At the top of the page, the value reduced is 10 percent, not 90 percent.
- Page 317
- In Listing 20-7, the word "structure" is misspelled. As the typo is in a comment, this misspelling doesn't affect the code.
- Page 357
- For Exercise 22-17, the reference to an earlier Exercise should read 20-13, not 20-12.
- Page 367
- The source code Listing 23-5 fails to use the fclose() function to close the two open files. The files should be closed or there is no guarantee that all the data is copied.
- Page 418
- The final bullet on the page is incorrect. You can specify any character code value using the format
\0nn
or\nn
wherenn
is an octal value. (Octal values aren't listed in Appendix A; click here for a list.) Octal values are prefixed by a zero in C, though this prefix isn't necessary with the backslash escape character. Also,\33
, is the code for Escape (decimal 27, hex 0x1b), not the exclamation point. At one time, some compilers did allow for the\nn
prefix for ASCII code values in decimal. This anomaly is no longer the case.
Copyright © 1997-2025 by QPBC.
All rights reserved