C Reference Book

Hi All,

Which one do you think is better as the C reference book: C in a Nutshell (O'Reilly, 2005) or C Primer Plus 5th ed. (Sams, 2004)?

I knew both of them should be great, but I certainly do not want to buy both. Any suggestion? Thanks!

My first choice is neither, but rather the K&R standard: The C Programming Language (book - Wikipedia, the free encyclopedia). It really is the best book. One of the books' authors designed the language while the other designed the AWK language.

While I like O'Reilly books, these are generally targeted toward a slightly more sophisticated audience. Reader reviews from Amazon confirm that this book's best features are its detailed reference of the standard library, an absolute necessity if you are going to be programming in a non-Windows environment; the book also contains explanations of using gdb and make, rather necessary tools for modern C development in UNIX. By contrast, the reviews about the Sams book indicate that at 900+ pages, this book is geared toward even the beginning programmer, and is described as teaching a "Plain Vanilla" C, ie, not especially for UNIX nor Windows.

Thanks for your suggestion! I just bought C Programming Language 2nd ed. (Prentice Hall), do you think that should be enough? I am just wondering if I also need to get a reference book. By the way I am doing programming in UNIX most of the time.

What kind of applications will you be writing? Kernel modules? System daemons? X applications? HPC (MPI) / scientific programming?

Most are scientific programming and text processing.

Then I would go with C programming in a nutshell. Here are two books I found on Amazon. Based on their TOC, these are recommended:

Amazon.com: String Processing and Text Manipulation in C: Selected Data Structures and Techniques/Book and Disk (Prentice Hall Series on Programming Tools and M): Bernice Sacks Lipkin: Books

Amazon.com: Introduction to Scientific Programming: Computational Problem Solving Using Maple and C: Joseph L. Zachary: Books

The second book covers the all-important topic of dealing with numbers inside programming languages. While this may not seem a big deal at first, it turns out that accumulation of "round-off" error can have huge implications. For instance, using single precision floating point as opposed to double precision can save 20 to 30 % processing speed, but it can also guarantee your results will be absolute mush.

Best of luck to you.

C Programming Language, 2nd Ed by Brian W. Kernighan Dennis M. Ritchie