knking.com -- Programming Language Books and Training

 C C++ Java

Books by K. N. King

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

C Programming: A Modern Approach (Second Edition)

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 10. A sentence near the middle of the page states that "The \n code tells printf to advance to the next line after printing the message." This makes it sound as if \n is a character sequence with special meaning specific to printf instead of an escape sequence with special meaning in any string literal. Suggested change: "The \n code is an escape sequence [forward reference to Section 3.1] representing a new-line character which instructs printf to advance to the next line after printing the message." (Rob Gamble)

Page 416. A sentence just above the Q&A icon states "In general, we can assign a void * value to a variable of any pointer type and vice versa." Actually, this is only true for pointers to object/data types; pointers to functions cannot reliably be converted to void pointers or vice versa in ISO C (they can in POSIX). I would also suggest a small section describing the void type and void pointers in a little more detail. Specifically, describing why void pointers are useful, that pointer arithmetic cannot be performed on them (as a void pointer represents an object's address but not its type) so they must be appropriately converted to another pointer type first (although many compilers allow pointer arithmetic on void pointers as it they were pointers to char), and that dereferencing a void pointer is only valid in a void context and essentially useless would constitute a welcome addition. (Rob Gamble)

Page 421. A Q&A question addressing why calloc has two arguments while malloc only has one would be useful. (Rob Gamble)

Google
 
Web knking.com

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