Errata
Errors were corrected in the second and
third printings of C Programming: A Modern Approach. (To
see which printing you have, look at the series of numbers at
the bottom of the copyright page. The first number indicates
the printing.)
For a list of other comments and suggested
improvements, click here. To report
errors or make suggestions, please email
me.
Errors to be corrected in a future
printing
Page 535.
The second and third calls of strtok on this page need to be switched. The second call
should be
p = strtok(NULL, " \t");
and the third call should be
p = strtok(NULL, " \t,");
(Found by Steve Mount.)
Errors corrected in the third
printing
Page xx.
In the third line of the paragraph headed "Emphasize style,"
the word "chose" should be "choose." (Found
by Harry D. Jeffery.)
Page 143.
Line 8 should begin "It's illegal for AN initializer."
(Found by Neil Zanella.)
Page 203.
Exercise 3 asks the reader to move all external variables into
main and modify the functions so that they communicate
by passing arguments. However, passing pointers to variables
(which is necessary here) is not covered until the following
chapter. In the third printing, the reader is asked to move only
the num_in_rank and num_in_suit arrays into main .
(Found by David Wittenberg.)
Page 231.
In the nested for loops near the bottom of the page,
the first appearance of N should be replaced by
NUM_ROWS , and the second
should be replaced by NUM_COLS .
(Found by Neil Zanella.)
Page 246.
The discussion of % nc that begins at the bottom of this page and continues
at the top of the next page is wrong. The correct conversion
is %. ns . In the third printing, both pages have been rewritten.
(Found by Neil Zanella.)
Page 297.
Line 5 should end with the words "a second macro whose job
is TO call STR ."
(Found by Marge Hicks.)
Page 298.
In Exercise 3, double
should be DOUBLE .
Page 367.
The first paragraph should end with the words "which ARE
all guaranteed to be zero initially:". (Found by Marge Hicks.)
Page 397.
The prototype given in Exercise 13 should read
int sum(int (*f)(int), int start, int end);
(Found by Marge Hicks.)
Page 500.
In the while statement near the middle of the page,
getchar() should be replaced
by getc(fp) .
Page 646.
The entry for "%c
conversion specification" should not include pages 246-47.
Page 646.
In the second column, "Cohension" should be "Cohesion."
Errors corrected in the second
printing
Page 30.
The program described in Exercise 8 labels its output "With
5% tax added:" . Unfortunately,
the reader doesn't yet know how to print the % symbol (that's explained in Chapter 3). In the
second printing, the label is "With tax added:" .
Page 43.
The word "float" in Exercise 2 is in the wrong font.
Page 88.
Just above the heading "Summing a Series of Numbers,"
the line should read "printf
right-justifies numbers WHEN a field width is specified."
(Found by Jim Clarke.)
Page 124.
The calls of printf shown
at the top of the page are not correct for all compilers, since
sizeof may produce an
unsigned long int value
instead of an unsigned
int . In the second printing,
Section 7.4 has been rewritten. The size of the int type is now written using the following statement:
printf("Size of int: %lu\n", (unsigned long)
sizeof(int));
Page 136.
The program described in Exercise 9 is supposed to label its
output. That can't be done unless the program stores the phone
number in an array, but arrays aren't covered until the next
chapter. In the second printing, the program won't label its
output.
Page 136.
In Exercise 11, "match the reminder" should be "match
the remainder." (Found by Phil Nachtsheim.)
Page 146.
Line 7 should read
printf("%6d%%", low_rate+i);
(Found by Joseph I. Halberstam.)
Page 149.
In the second paragraph under "Dealing a Hand of Cards,"
"obviously" should be "obvious." (Found by
Marge Hicks.)
Page 152.
In Exercise 3, "number that" should be "number
that's." (Found by Marge Hicks.)
Page 171.
The value of EXIT_SUCCESS
is not required to be 0, although passing either value to the
exit function has the
same effect. (Found by Peter Seebach.)
Page 192.
On line 5, the words int
secret_number (in the
parameter list) should be bold. (Found by Jim Clarke.)
Page 202.
On the second line of the first answer, "its" should
be "it's." (Found by Jim Clarke.)
Page 264.
The ls -ld m* example
is not described correctly for UNIX. Standard UNIX shells replace
m* by all file names that
start with m , so the number
of command arguments will vary. In the second printing, pages
263-264 have been rewritten, and the example has been changed
to ls -l remind.c .
(Found by Jim Clarke.)
Page 325.
In the answer to the first question, the next-to-last sentence
should begin "Of course, we would HAVE gotten away..."
(Found by Leonard Posusta.)
Page 337.
In the person_name structure,
the first member should
have length FIRST_NAME_LEN+1 ,
and the last member should
have length LAST_NAME_LEN+1 .
(Found by Joseph I. Halberstam.)
Page 406.
The item labeled "Easier maintenance" states that "Declaring
a function f to be static guarantees that f
is never called outside the file in which its definition appears."
That statement is false, since a function in another file could
be passed a pointer to f .
In the second printing, the entire paragraph has been rewritten.
(Found by Chris Jiang.)
Page 449.
In the answer to the question, third paragraph, second line,
"that" should be "than." (Found by Jim Clarke.)
Page 479.
The compiler is not required to treat \p as an escape sequence (its meaning is undefined).
(Found by Peter Seebach.)
Page 528.
In both the program and its output, replace ctnrl with cntrl .
(Found by Jim Clarke.) |