share
Stack OverflowThe Definitive C Book Guide and List
[+400] [1] lillq
[2009-02-18 18:32:02]
[ c ]
[ https://stackoverflow.com/questions/562303/the-definitive-c-book-guide-and-list ]

This question attempts to collect a community-maintained list of quality books on the [1] programming language, targeted at various skill levels.

C is a complex programming language that is difficult to pick up on-the-go by reading online tutorials. A comprehensive book is often the best way to learn the language, and finding a good book is the first step. It is important to avoid badly-written books, and even more importantly, books that contain serious technical errors.

Please suggest edits to the accepted answer to add quality books, with an approximate skill level and a short blurb/description about each book. (Note that the question is locked, so no new answers will be accepted. A single answer is being maintained with the list)

Feel free to debate book choices, quality, headings, summaries, skill levels, and anything else you see that is wrong. Books that are deemed satisfactory by the C community here will stick around on the list; the rest will be regularly removed.

For books that have reviews by the Association of C and C++ Users (ACCU), a link to those reviews should be added along with the book.

See also:


This question was discussed on Meta [6] as part of the Deleted Questions Audit 2018 [7].
The consensus was to keep it undeleted and actively maintained.

(4) If you are new to C, keep in mind that modern C is ANSI C and anything predating that standard (1989) may be wildly out of date. Shoot for the mid-90s or later. - Dana Robinson
(7) @Dhaivat I think not, be careful to jump on the K&R bandwagon. K&R does not address good program design nor good programming practice, mainly because it was originally written before anyone knew what good programming practice was. It does not mention which parts of the C language that are superfluous or even dangerous. The book is correctly listed as a reference manual, it should not be used for teaching/learning modern programming. - Lundin
[+583] [2009-02-18 18:54:22] Tom Ritter

Warning!

This is a list of random books of diverse quality. In the view of some people (with some justification), it is no longer a list of recommended books. Some of the listed books contain blatantly incorrect statements or teach wrong/harmful practices. People who are aware of such books can edit this answer to help improve it. See The C book list has gone haywire. What to do with it? [1], and also Deleted question audit 2018 [2].

Reference (All Levels)


Beginner

Intermediate

  • Modern C [25] — Jens Gustedt (2017 1st Edn; 2019 2nd Edn). Covers C in 5 levels (encounter, acquaintance, cognition, experience, ambition) from beginning C to advanced C. It covers C11 and C17, including threads and atomic access, which few other books do. Not all compilers recognize these features in all environments.

  • C Interfaces and Implementations [26] - David R. Hanson (1997). Provides information on how to define a boundary between an interface and implementation in C in a generic and reusable fashion. It also demonstrates this principle by applying it to the implementation of common mechanisms and data structures in C, such as lists, sets, exceptions, string manipulation, memory allocators, and more. Basically, Hanson took all the code he'd written as part of building Icon [27] and lcc [28] and pulled out the best bits in a form that other people could reuse for their own projects. It's a model of good C programming using modern design techniques (including Liskov [29]'s data abstraction), showing how to organize a big C project as a bunch of useful libraries.

  • The C Puzzle Book [30] - Alan R. Feuer (1998)

  • The Standard C Library [31] - P.J. Plauger (1992). It contains the complete source code to an implementation of the C89 standard library, along with extensive discussions about the design and why the code is designed as shown.

  • 21st Century C: C Tips from the New School [32] - Ben Klemens (2012). In addition to the C language, the book explains gdb, valgrind, autotools, and git. The comments on style are found in the last part (Chapter 6 and beyond).

  • Algorithms in C [33] - Robert Sedgewick (1997). Gives you a real grasp of implementing algorithms in C. Very lucid and clear; will probably make you want to throw away all of your other algorithms books and keep this one.

Expert


Uncategorized

  • Essential C [42] (Free PDF) - Nick Parlante (2003). Note that this describes the C90 language at several points (e.g., in discussing // comments and placement of variable declarations at arbitrary points in the code), so it should be treated with some caution.

  • C Programming FAQs: Frequently Asked Questions [43] - Steve Summit (1995). This is the book of the web site listed earlier. It doesn't cover C99 or the later standards.

  • C in a Nutshell [44] - Peter Prinz and Tony Crawford (2005). Excellent book if you need a reference for C99.

  • C in a Nutshell (2nd Ed.) [45] - Peter Prinz and Tony Crawford (2016), a reference-style book covering C11.

  • Functional C [46] - Pieter Hartel and Henk Muller (1997). Teaches modern practices that are invaluable for low-level programming, with concurrency and modularity in mind.

  • The Practice of Programming [47] - Brian W. Kernighan and Rob Pike (1999). A very good book to accompany K&R. It uses C++ and Java too.

  • C Traps and Pitfalls [48] by A. Koenig (1989). Very good, but the C style pre-dates standard C, which makes it less recommendable these days.

    Some have argued for the removal of 'Traps and Pitfalls' from this list because it has trapped some people into making mistakes; others continue to argue for its inclusion. Perhaps it should be regarded as an 'expert' book because it requires moderately extensive knowledge of C to understand what's changed since it was published.

  • MISRA-C [49] - industry standard published and maintained by the Motor Industry Software Reliability Association. Covers C89 and C99.

    Although this isn't a book as such, many programmers recommend reading and implementing as much of it as possible. MISRA-C was originally intended as guidelines for safety-critical applications in particular, but it applies to any area of application where stable, bug-free C code is desired (who doesn't want fewer bugs?). MISRA-C is becoming the de facto standard in the whole embedded industry and is getting increasingly popular even in other programming branches. There are (at least) three publications of the standard (1998, 2004, and the current version from 2012). There is also a MISRA Compliance Guidelines document from 2016, and MISRA C:2012 Amendment 1 — Additional Security Guidelines for MISRA C:2012 (published in April 2016).

    Note that some of the strictures in the MISRA rules are not appropriate to every context. For example, directive 4.12 states "Dynamic memory allocation shall not be used". This is appropriate in the embedded systems for which the MISRA rules are designed; it is not appropriate everywhere. (Compilers, for instance, generally use dynamic memory allocation for things like symbol tables, and to do without dynamic memory allocation would be difficult, if not preposterous.)

  • Archived lists of ACCU-reviewed books on Beginner's C [50] (116 titles) from 2007 and Advanced C [51] (76 titles) from 2008. Most of these don't look to be on the main site anymore, and you can't browse that by subject anyway.


Warnings

There is a list of books and tutorials to be cautious about at the ISO 9899 Wiki [52], which is not itself formally associated with ISO or the C standard, but contains information about the C standard (though it hails the release of ISO 9899:2011 and does not mention the release of ISO 9899:2018).

Be wary of books written by Herbert Schildt [53]. In particular, you should stay away from C: The Complete Reference [54] (4th Edition, 2000), known in some circles as C: The Complete Nonsense.

Also do not use the book Let Us C [55] (16th Edition, 2017) by Yashavant Kanetkar. Many people view it as an outdated book that teaches Turbo C and has lots of obsolete, misleading and incorrect material. For example, page 137 discusses the expected output from printf("%d %d %d\n", a, ++a, a++) and does not categorize it as undefined behaviour [56] as it should. It also consistently promotes unportable and buggy coding practices, such as using gets, %[\n]s in scanf, storing the return value of getchar in a variable of type char or using fflush on stdin.

Learn C The Hard Way [57] (2015) by Zed Shaw. A book with mixed reviews. A critique of this book [58] by Tim Hentenaar:

To summarize my views, which are laid out below, the author presents the material in a greatly oversimplified and misleading way, the whole corpus is a bundled mess, and some of the opinions and analyses he offers are just plain wrong. I've tried to view this book through the eyes of a novice, but unfortunately I am biased by years of experience writing code in C. It's obvious to me that either the author has a flawed understanding of C, or he's deliberately oversimplifying to the point where he's actually misleading the reader (intentionally or otherwise).

"Learn C The Hard Way" is not a book that I could recommend to someone who is both learning to program and learning C. If you're already a competent programmer in some other related language, then it represents an interesting and unusual exposition on C, though I have reservations about parts of the book. Jonathan Leffler


Outdated


Other contributors, not necessarily credited in the revision history, include: Alex Lockwood [60], Ben Jackson [61], Bubbles [62], claws [63], coledot [64], Dana Robinson [65], Daniel Holden [66], desbest [67], Dervin Thunk [68], dwc [69], Erci Hou [70], Garen [71], haziz [72], Johan Bezem [73], Jonathan Leffler [74], Joshua Partogi [75], Lucas [76], Lundin [77], Matt K. [78], mossplix [79], Matthieu M. [80], midor [81], Nietzche-jou [82], Norman Ramsey [83], r3st0r3 [84], ridthyself [85], Robert S. Barnes [86], smalinux [87], Steve Summit [88], Tim Ring [89], Tony Bai [90], VMAtm [91]

[1] https://meta.stackoverflow.com/questions/355588/the-c-book-list-has-gone-haywire-what-to-do-with-it
[2] https://meta.stackoverflow.com/questions/378437/deleted-question-audit-2018
[3] https://rads.stackoverflow.com/amzn/click/com/0131103628
[4] https://en.wikipedia.org/wiki/Brian_Kernighan
[5] https://en.wikipedia.org/wiki/Dennis_Ritchie
[6] https://en.wikipedia.org/wiki/ANSI_C#C89
[7] https://en.wikipedia.org/wiki/C99
[8] https://rads.stackoverflow.com/amzn/click/com/013089592X
[9] https://rads.stackoverflow.com/amzn/click/com/0596004362
[10] http://c-faq.com/
[11] http://www.iso-9899.info/wiki/The_Standard
[12] http://port70.net/%7Ensz/c/c11/n1570.html
[13] http://www.knosof.co.uk/cbook/cbook.html
[14] http://www.open-std.org/JTC1/SC22/WG14/www/C99RationaleV5.10.pdf
[15] http://knking.com/books/c2/index.html
[16] https://rads.stackoverflow.com/amzn/click/com/0321776410
[17] https://rads.stackoverflow.com/amzn/click/com/0672326965
[18] https://rads.stackoverflow.com/amzn/click/com/0201183994
[19] http://publications.gbdirect.co.uk/c_book/
[20] https://www.amazon.com//dp/0133976890
[21] https://rads.stackoverflow.com/amzn/click/com/1449399916
[22] https://www.apress.com/book/9781430248811
[23] https://rads.stackoverflow.com/amzn/click/com/0672324482
[24] https://smile.amazon.com/Programming-easy-steps-5th-Compiler/dp/1840788402/
[25] https://modernc.gforge.inria.fr/
[26] http://www.cs.princeton.edu/software/cii/
[27] http://www.cs.arizona.edu/icon
[28] http://www.cs.princeton.edu/software/lcc/
[29] https://en.wikipedia.org/wiki/Barbara_Liskov#Recognition_and_awards
[30] https://rads.stackoverflow.com/amzn/click/com/0201604612
[31] https://rads.stackoverflow.com/amzn/click/com/0131315099
[32] https://rads.stackoverflow.com/amzn/click/com/1449327141
[33] https://rads.stackoverflow.com/amzn/click/com/0201314525
[34] https://rads.stackoverflow.com/amzn/click/com/0673999866
[35] https://rads.stackoverflow.com/amzn/click/com/0321535421
[36] https://rads.stackoverflow.com/amzn/click/com/B00101Y58Q
[37] https://rads.stackoverflow.com/amzn/click/com/0672318962
[38] http://www.planetpdf.com/codecuts/pdfs/ooc.pdf
[39] https://rads.stackoverflow.com/amzn/click/com/0131774298
[40] https://rads.stackoverflow.com/amzn/click/com/0534951406
[41] https://rads.stackoverflow.com/amzn/click/com/0321637739
[42] http://cslibrary.stanford.edu/101/EssentialC.pdf
[43] https://rads.stackoverflow.com/amzn/click/com/0201845199
[44] https://rads.stackoverflow.com/amzn/click/com/0596006977
[45] https://rads.stackoverflow.com/amzn/click/com/1491904755
[46] https://rads.stackoverflow.com/amzn/click/com/0201419505
[47] https://rads.stackoverflow.com/amzn/click/com/020161586X
[48] https://rads.stackoverflow.com/amzn/click/com/0201179288
[49] http://www.misra-c.com/Activities/MISRAC/tabid/160/Default.aspx
[50] https://web.archive.org/web/20071105015557/http://www.accu.informika.ru/bookreviews/public/reviews/0sb/beginner_s_c.htm
[51] https://web.archive.org/web/20081020081215/http://www.accu.informika.ru/bookreviews/public/reviews/0sb/advanced_c.htm
[52] http://iso-9899.info/wiki/Main_Page#Stuff_that_should_be_avoided
[53] http://catb.org/%7Eesr/jargon/html/B/bullschildt.html
[54] https://rads.stackoverflow.com/amzn/click/com/0072121246
[55] https://smile.amazon.com/dp/9387284492/
[56] https://stackoverflow.com/questions/949433/why-are-these-constructs-using-pre-and-post-increment-undefined-behavior
[57] https://learncodethehardway.org/c/
[58] http://hentenaar.com/dont-learn-c-the-wrong-way
[59] https://rads.stackoverflow.com/amzn/click/com/1565923065
[60] https://stackoverflow.com/users/844882/alex-lockwood
[61] https://stackoverflow.com/users/479989/ben-jackson
[62] https://stackoverflow.com/users/631423/bubbles
[63] https://stackoverflow.com/users/193653/claws
[64] https://stackoverflow.com/users/14463/coledot
[65] https://stackoverflow.com/users/3161/dana-robinson
[66] https://stackoverflow.com/users/1322636/daniel-holden
[67] https://stackoverflow.com/users/337306/desbest
[68] https://stackoverflow.com/users/50305/dervin-thunk
[69] https://stackoverflow.com/users/57301/dwc
[70] https://stackoverflow.com/users/2226524/eric-hou
[71] https://stackoverflow.com/users/102600/garen
[72] https://stackoverflow.com/users/714232/haziz
[73] https://stackoverflow.com/users/1029106/johan-bezem
[74] https://stackoverflow.com/users/15168/jonathan-leffler
[75] https://stackoverflow.com/users/141186/joshua-partogi
[76] https://stackoverflow.com/users/74660/lucas
[77] https://stackoverflow.com/users/584518/lundin
[78] https://stackoverflow.com/users/52734/mattk
[79] https://stackoverflow.com/users/487623/mossplix
[80] https://stackoverflow.com/users/147192/matthieu-m
[81] https://stackoverflow.com/users/3991400/midor
[82] https://stackoverflow.com/users/39892/nietzche-jou
[83] https://stackoverflow.com/users/41661/norman-ramsey
[84] https://stackoverflow.com/users/416623/r3st0r3
[85] https://stackoverflow.com/users/2395058/ridthyself
[86] https://stackoverflow.com/users/71074/robert-s-barnes
[87] https://stackoverflow.com/users/5688267/smalinux
[88] https://stackoverflow.com/users/3923896/steve-summit
[89] https://stackoverflow.com/users/3685/tim-ring
[90] https://stackoverflow.com/users/207003/tony-bai
[91] https://stackoverflow.com/users/213550/vmatm

@LorenzoDonati--Codidact.com — the list is a lot less random than it originally was, but is still not as definitive or comprehensive as would be desirable. It is actively maintained. There are still books in the list that I've not reviewed that I regard as somewhat dubious. It lists a few old books about pre-standard C that should perhaps be removed. - Jonathan Leffler
Here is a project with clear and tested solutions to the exercises in the C Programming Language by K and R, hope it helps: github.com/double-o-z/TheCProgramming_KandR - DoubleOZ
Thank you for helping curate this list @JonathanLeffler. If possible, could you please indicate which books are pending review, e.g. an asterisk before the title? I'm looking for an introductory text, so it would help to know which titles are definitely recommended. - user51462
How about "C A Software Engineering Approach (3rd Edition)" by Darnell and Margolis (1996)? It was a nice book to study from in the mid 2000s. - Hari
"Effective C" by Robert Seacord is a very good book but it is not a beginner's book. It is far closer to an updated version of K&R "C Programming Language." - Jeff Szuhay
(3) @Hari Why should we add even more outdated books to the list? It's bad enough as it is... Anything which doesn't at least cover C11 is questionable, anything which doesn't at least cover C99 is a historical relic not suitable for learning. - Lundin
@Lundin I agree with you. It is a well written book. At the same time, there are many good books that are much more up-to-date. It is better to go with good books that are still relevant. - Hari
(2) The link to Modern C by Jens Gustedt (Intermediate section) is broken. Here is a new link: inria.hal.science/hal-02383654v1/file/ModernC.pdf - fu7zed
Hi, I want to make an addition to the list, but I am unable to submit the edit for some reason- I get an error which says my code isn't formatted correctly (which is weird because I put no code). This is what I would add: # Beginner - C Programming: Absolute Beginner's Guide (3rd Edition) - Greg Perry and Dean Miller (2013). This book is amazing and is perfect for anyone who has no experience, or does and wants to learn a new language. There are a lot of beginner texts for C, but this one takes the cake. - Sid
1