-- Programming Language Books and Training

 C C++ Java

Books by K. N. King

Books by K. N. King
Short courses
Recommended books
Recommended links

C Programming: A Modern Approach

Suggested Improvements

I've received a number of suggested improvements to the book. Most will have to wait until the next edition, but I've listed them here because they should be of interest to many readers.

Page 11. The -Wall option for gcc is good, but -Wall -O is needed for -Wall to have its full effect. (J. Blustein)

Page 11. Richard Stallman's complaint is not limited to high-priced software; he disapproves of cheap PC software too. Rather, his objection is to proprietary software. (Peter Seebach)

Page 83. In Exercise 8, "speed" would be a more accurate term than "velocity," which is normally used to describe vectors having both a magnitude and a direction. (Neil Zanella)

Page 112. The discussion of integer constants lacks precision. Decimal constants too large to be long integers are treated as unsigned long integers. Octal and hex constants go int-unsigned-long-unsigned long. For example, on a 16-bit machine, 0x8000 is an unsigned integer, not a signed long integer. (Peter Seebach)

Page 150. It would be better to initialize the in_hand array to FALSE. (Jim Clarke)

Page 151. There should be a warning that the expression ch-'a' is not portable to all machines. (Peter Seebach)

Pages 242 and 266. There are systems where changing the contents of string literals is not possible, as in "segmentation fault, core dumped". (Peter Seebach)

Page 248. gets and puts being faster may be a performance myth, although it's frequently true. (Peter Seebach)

Page 257. It should be pointed out that you can't legally define strlen and strcat (the behavior is undefined). The same is true of string, stroke, str[a-z]*, as well as is*, to*, etc. (Peter Seebach)

Page 336. There should be a cross-reference to automatic versus static storage duration. (Jim Clarke)

Pages 341-344. Use puts instead of printf wherever possible in this program. Also, the insert function fails if read_line or scanf reads EOF. (Jim Clarke)

Pages 388 and 394. Subtracting integer values to perform a comparison is risky, because of the possibility of overflow. The compare_ints function on page 394 is especially dangerous, since we don't know the values of the integers to be sorted. (Dave Wortman)

Page 459. & needs to be identified as the address operator here. (Jim Clarke)

Page 479. When calling fopen to open a DOS file, we can avoid problems by using / as the separator between directory names. For example, instead of

fopen("c:\\project\\test1.dat", "r")

we could write

fopen("c:/project/test1.dat", "r")

(Peter Seebach)

Section 22.6. There should be a warning here or in the Q & A section at the end of the chapter that writing out data structures containing pointers and then trying to read them back in will almost always give the wrong result. (Dave Wortman)

Page 527. The semicolon at the end of the TEST macro is unnecessary. (Jim Clarke)

Page 568. The semicolon at the end of the CHK_VALID macro is unnecessary. (Jim Clarke)


Copyright © 1999-2009 K. N. King. All rights reserved.