The Definitive C Book Guide and List - c

This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
This question attempts to collect a community-maintained list of quality books on the c 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:
Other C-related resources in the c tag wiki
A similar list for c++: The Definitive C++ Book Guide and List
This question was discussed on Meta as part of the Deleted Questions Audit 2018.The consensus was to keep it undeleted and actively maintained.

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?, and also Deleted question audit 2018.
Reference (All Levels)
The C Programming Language (2nd Edition) - Brian W. Kernighan and Dennis M. Ritchie (1988). Still a good, short but complete introduction to C (C90, not C99 or later versions), written by the inventor of C. However, the language has changed and good C style has developed in the last 25 years, and there are parts of the book that show its age.
C: A Reference Manual (5th Edition) - Samuel P. Harbison and Guy R. Steele (2002). An excellent reference book on C, up to and including C99. It is not a tutorial, and probably unfit for beginners. It's great if you need to write a compiler for C, as the authors had to do when they started.
C Pocket Reference (O'Reilly) - Peter Prinz and Ulla Kirch-Prinz (2002).
The comp.lang.c FAQ - Steve Summit. Web site with answers to many questions about C.
Various versions of the C language standards can be found here. There is an online version of the draft C11 standard.
The new C standard - an annotated reference (Free PDF) - Derek M. Jones (2009). The "new standard" referred to is the old C99 standard rather than C11.
Rationale for C99 Standard.
Beginner
C Programming: A Modern Approach (2nd Edition) - K. N. King (2008). A good book for learning C.
Programming in C (4th Edition) - Stephen Kochan (2014). A good general introduction and tutorial.
C Primer Plus (5th Edition) - Stephen Prata (2004)
A Book on C - Al Kelley/Ira Pohl (1998).
The C Book (Free Online) - Mike Banahan, Declan Brady, and Mark Doran (1991).
C: How to Program (8th Edition) - Paul Deitel and Harvey M. Deitel (2015). Lots of good tips and best practices for beginners. The index is very good and serves as a decent reference (just not fully comprehensive, and very shallow).
Head First C - David Griffiths and Dawn Griffiths (2012).
Beginning C (5th Edition) - Ivor Horton (2013). Very good explanation of pointers, using lots of small but complete programs.
Sams Teach Yourself C in 21 Days - Bradley L. Jones and Peter Aitken (2002). Very good introductory stuff.
C In Easy Steps (5th Edition) - Mike McGrath (2018). It is a good book for learning and referencing C.
Effective C - Robert C Seacord (2020). A good introduction to modern C, including chapters on dynamic memory allocation, on program structure, and on debugging, testing and analysis. It has some pointers toward probable C2x features.
Intermediate
Modern C — 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 - 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 and lcc 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's data abstraction), showing how to organize a big C project as a bunch of useful libraries.
The C Puzzle Book - Alan R. Feuer (1998)
The Standard C Library - 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 - 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 - 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.
Pointers on C - Kenneth Reek (1997).
Problem Solving and Program Design in C (6th Edition) - Jeri R. Hanly and Elliot B. Koffman (2009).
Data Structures - An Advanced Approach Using C - Jeffrey Esakov and Tom Weiss (1989).
C Unleashed - Richard Heathfield, Lawrence Kirby, et al. (2000). Not ideal, but it is worth intermediate programmers practicing problems written in this book. This is a good cookbook-like approach suggested by comp.lang.c contributors.
Object-oriented Programming with ANSI-C (Free PDF) - Axel-Tobias Schreiner (1993).
The code gets a bit convoluted. If you want C++, use C++. It only uses C90, of course.
Expert
Expert C Programming: Deep C Secrets - Peter van der Linden (1994). Lots of interesting information and war stories from the Sun compiler team, but a little dated in places.
Advanced C Programming by Example - John W. Perry (1998).
Advanced Programming in the UNIX Environment - Richard W. Stevens and Stephen A. Rago (2013). Comprehensive description of how to use the Unix APIs from C code, but not so much about the mechanics of C coding.
Uncategorized
Essential C (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 - 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 - Peter Prinz and Tony Crawford (2005). Excellent book if you need a reference for C99.
C in a Nutshell (2nd Ed.) - Peter Prinz and Tony Crawford (2016), a reference-style book covering C11.
Functional C - 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 - 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 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 - 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 (116 titles) from 2007 and Advanced C (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, 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. In particular, you should stay away from C: The Complete Reference (4th Edition, 2000), known in some circles as C: The Complete Nonsense.
Also do not use the book Let Us C (16th Edition, 2017) by Yashwant 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 as it should. It also consistently promotes unportable and buggy coding practices, such as using gets, %[\n]s in scanf, storing return value of getchar in a variable of type char or using fflush on stdin.
Learn C The Hard Way (2015) by Zed Shaw. A book with mixed reviews.
A critique of this book 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
Practical C Programming (3rd Edition) - Steve Oualline (1997)(Beginner)
Other contributors, not necessarily credited in the revision history, include:
Alex Lockwood,
Ben Jackson,
Bubbles,
claws,
coledot,
Dana Robinson,
Daniel Holden,
desbest,
Dervin Thunk,
dwc,
Erci Hou,
Garen,
haziz,
Johan Bezem,
Jonathan Leffler,
Joshua Partogi,
Lucas,
Lundin,
Matt K.,
mossplix,
Matthieu M.,
midor,
Nietzche-jou,
Norman Ramsey,
r3st0r3,
ridthyself,
Robert S. Barnes,
smalinux,
Steve Summit,
Tim Ring,
Tony Bai,
VMAtm

Related

Does C have 32 or 44 keywords?

ISO/IEC 9899:2017 C N2176 document link: https://files.lhmouse.com/standards/ISO%20C%20N2176.pdf
There are plenty of sources on world wide web, which say that there are 32 keywords in C langauge, But this document (I think it's a draft version, but there's no much changes as compared to the previous version, right?) has 44 words that are defined to the keywords of C language.
Please explain this.
============================================================
Link to the sources which say that there are 32 keywords in C language:
https://www.programiz.com/c-programming/list-all-keywords-c-language
https://tutorials.webencyclop.com/c-language/c-keyword/
https://www.educba.com/c-keywords/
https://www.javatpoint.com/keywords-in-c
https://beginnersbook.com/2014/01/c-keywords-reserved-words/
https://www.phptpoint.com/c-keywords/
https://www.guru99.com/c-tokens-keywords-identifier.html
https://fresh2refresh.com/c-programming/c-tokens-identifiers-keywords/
https://www.w3schools.in/c-tutorial/keywords/
Note: Some of these sites are useful for beginners to learn basic concepts and terminalogies of C.
The claims of there being "32" keywords in C refer to the original ANSI-specified version of C from 1989, aka C89.
Because this is the Internet, and because the real C specifications are behind ISO's ridiculous paywall most people so-inclined probably can't fact-check the claim.
And it's not a claim worth fact-checking: the number of keywords in a language is utter trivia of no consequence.
The ISO/IEC 9899 specification you linked to refers to C17 (the proposed updated C specification in 2017) which postdates C89 by 28 years.
It should come as no surprise that a future updated revision of a programming language introduces new keywords.
Historically, when C was introduced, people were impressed by its minimalist syntax and how the language's design effectively reified everything by implementing functionality as library features instead of language features which is what keeps C simple and helps mitigate every language's designer's fears about feature creep.
In comparison, C's early contemporaries like COBOL, opted to implement functionality into their own languages as first-class features, which is why COBOL has over 300 keywords; so I'll admit that using the stark difference in keyword-count does serve as a proxy for language-complexity and by extension: a way to almost quantify good design. But using it as the basis for comparing languages today in 2021 is of limited-utility as the most relevant programming languages today1 are already either inspired by C or derived from it somehow, and they all share C's decision to do things in the library instead of the language, so all those languages similarly have a low keyword count compared to COBOL, SQL, and others, and so that's why C's keyword count just isn't interesting anymore.
1: C-inspired or C-derived languages in use today: C++, Objective-C, Java, Groovy, Swift, C#, JavaScript, TypeScript, Go, PHP, Perl. Other popular languages that aren't modelled on C (like Haskell, OCaml, etc) do share C's library-first philosophy, but I can't say if C originated it or not - but I feel that languages opting for library-first designs is inevitable: the cost to implement language-features is easily ten-fold that of implementing library features.

Where can I find the C specification? [duplicate]

This question already has answers here:
Where do I find the current C or C++ standard documents?
(11 answers)
Closed 3 years ago.
I am in the situation where I may have the opportunity to teach C to some students. The University wants to teach them pure c, not c++, to keep the advanced c++ course separate.
Since c++ is derived from c, is there an official "c rulebook" which contains all the features of c, but none of the c++ features? The reason I want to know is so I can look up what I need to teach the students.
I once saw a (2000 page?) manual on the c++ standard. Does such a thing exist for c, even if it is 20/30 years old by now?
Regards,
Ed
EDIT: I should point out I know C/C++ quite well having been teaching myself for 3 years. The only thing I don't know is what things are "officially" C and what things are "officially" C++. This is what I aim to learn so I can give the other students a better education than I could give myself.
There have been 3 official ISO C standards, published in 1990, 1999, and 2011. There have also been several "Technical Corrigenda", official documents making corrections to the standards.
The standard itself can be purchased in PDF (or paper) format from ISO or from your national standards body, such as the US ANSI. ANSI sells the C11 standard for about $30, but with strict licensing requirements. The Technical Corrigenda are available by themselves at no charge, but they're not useful without the standard. If you want to make the standard available to your class, that's probably not a practical way to do it.
But drafts of the C standards are often made available on the ISO C committee's site.
N1256 is a draft of the C99 standard with the three Technical Corrigenda merged into it. It's actually better for most purposes than the official C99 standard.
N1570 is the most recent (as far as I know, as I write this) draft of the 2011 ISO C standard, published before the ISO standard was released. There are only a few minor editorial differences between N1570 and the official standard.
There's also a small Technical Corrigendum to the C11 standard, containing a couple of fixes that aren't in either N1570 or C11: due to an oversight, the published standard didn't define the value of __STDC_VERSION__ and the optional __STDC_LIB_EXT1__ macros properly (both are 201112L).
Each standard (and draft) has a summary of the differences between it and the previous standard.
Apart from the standard (which is not really written for general programmers), Harbison & Steele's C: A Reference Manual is a very good reference. The current 5th edition covers C90 and C99, but not C11. (I don't know of any plans for a 6th edition.)
You're looking for a C standard. Since the standards bodies fund themselves through the sale of standard publications, you can't get the final version. However, there are many copies of C draft standards out there which are good enough for your purposes.
https://www.google.com/search?q=c+draft+standard+pdf
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf

Where would I go with an idea for the next C standard?

I've been reading up a lot on how C works, and I think I have an idea for how to make it better. From what I've read it seems like the standard changes from time to time, and I was wondering if there is a place I could go to submit a new idea for the next revision.
The committee's web site is http://www.open-std.org/JTC1/SC22/WG14/.
Their contact info is at http://www.open-std.org/JTC1/SC22/WG14/www/contacts.
The most recent C standard was released late last year; a draft that should be almost identical to the released standard, is N1570, or you can buy the official standard from the ANSI store, or from your national standards body.
Ideas are often discussed on the comp.std.c Usenet newsgroup; it's a good place to get feedback, but it has no official association with the committee.
Your idea will have a much better chance of being adopted if you can demonstrate existing practice, i.e., and existing C compiler that already implements it as an extension -- and if it doesn't violate the vaguely defined "spirit of C".

Documents about C language specs

I'm wondering about the difference between what is defined by the several standards of the C language and the things that every compilers implements in a different way from the others, i want to really understand what the official specs of the C language are: there are some official docs?
I'm looking for technical stuff, not a thread on the internet, some good pdfs maybe; something that can describe everything happens with the memory management, the allocation, the lenght and the encoding of the variables, etc etc ...
I have the official manual from K&R but it's not really about what i am interested to, it's more on the "programmer side" i want something more technical and affermative.
PS
the C language have an official website for reference?
Check this
"Obtaining the Standard
Neither the Standard nor its amendments are available free of charge, although its drafts, rationales, technical corrigenda (TCs) and defect report responses are.
The Standard can be purchased in hardcopy and/or downloadable digital format from national affiliates as described on the WG14 website. Two such national bodies are ANSI - through its eStandards Store - and SAI Global (originally Standards Australia) which sells all of the ISO C Standard publications. One international source is Techstreet.
Listed below are direct links to pages for purchase or free download of the Standard, its TCs, amendments, drafts, rationales and defect report responses for each version of the Standard. The set of documents is comprehensive whereas the list of sources obviously is not."
Tried to add this as a comment but the URL would not take.
Try: http://www.deitel.com/Default.aspx?tabid=204 for details on C. I also suggest you dig up GNU's big document on C as they do some things differently and it can be important to understand GNUs way of doing things. http://gcc.gnu.org/onlinedocs/.

Is there something like the official C documentation? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I'm looking for the documentation of all the syntax and built-in functions in C, but I can't find any site online which seems like an ultimate official source of standard C knowledge.
Apart from the famous book by Kernighan and Ritchie, isn't there any online C specification? Maybe there is, and I don't know how to find it. Or maybe the problem is that I don't exactly know what I'm looking for.
You can obtain a PDF copy of the C99 standard (ISO/IEC 9899:1999) from ANSI (and other fine standards organizations) for your private use for a modest fee - I believe it was 18 USD when I bought mine. Having that available is invaluable to me. But if you find a copy in public, then it is contraband.
You can find final committee drafts and current working documents of the C (C0x) Standard Committee at the JTC1, SC22, WG14 web site at the Open Standards Organization. (That's Joint Technical Committee 1, Sub-Committee 22, Working Group 14, I believe).
There is also a hardback book 'The C Standard: Incorporating Technical Corrigendum 1' (also including the Rationale) available for a slightly less modest 85 USD or thereabouts.
One of the best books about C is 'C: A Reference Manual' in its fifth edition. However, you asked for 'ultimate official source of standard C knowledge', and the only 'official' such source is the C standard, plus its corrigenda.
See also the material at http://www.coding-guidelines.com/ and http://c0x.coding-guidelines.com/.
There is this online website devdocs
They have multiple API documentations which are well organized. It is free and open-source.
For c doc click this link http://devdocs.io/c/
The official C99 standard is available for purchase from your national standards body; however, in practice everyone reads the draft with post-1999 corrections/amendments included, which you can download for free:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
Strictly speaking, the C standard is not available for free. You need to purchase an electronic copy from http://www.ansi.org/ or http://www.iso.org.
However, you can download a free draft version from the Open Standards Organization's website - this is as good as or better than the official standard itself. It incorporates information from the ISO C99 standard plus three Technical Corrigenda, all of which are official ISO documents.
More info here: http://c-faq.com/ansi/avail.html
Is there something like the official C documentation?
The most official documentation is the ISO standard, to which compilers are written and are expected to interpret correctly.
C99 Standard
Here's the latest Committee draft on the C99 Standard, last updated April 12, 2011:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
I'll try to keep it up to date with the latest version as I can.
Kernighan & Ritchie
I also found K&R's text, second edition, here: http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf
However, I'd use the -Wall flag when compiling the examples in the book so that you don't get led too far astray by the age of the text.
C is an ISO standardised language. Current specification is ISO/IEC 9899:1999 standard a.k.a. C99.
You can refer GNU C documentation at https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html
Specifically, this manual aims to document:
The 1989 ANSI C standard, commonly known as “C89”
The 1999 ISO C standard, commonly known as “C99”, to the extent that C99 is implemented by GCC
The current state of GNU extensions to standard C
There're various C standard specifications.
See C's history on wikipedia for example.
When we talk about standard C these days, we mostly refer to the ANSI C Standard.
Here's a link to the standard in textform:
http://flash-gordon.me.uk/ansi.c.txt
Look at The New C Standard: An Economic and Cultural Commentary.
If what you want is the documentation for the standard library functions, then P.J. Plauger's "The Standard C Library" http://www.amazon.com/Standard-C-Library-P-J-Plauger/dp/0131315099/ref=sr_1_1?s=books&ie=UTF8&qid=1290273108&sr=1-1 is the best reference. It's got pretty extensive annotation and comentary on the why and how of the standard.
https://msdn.microsoft.com/en-us/library/fw5abdx6.aspx
The "C Language Reference" describes the C programming language as implemented in Microsoft C. The book's organization is based on the ANSI C standard with additional material on the Microsoft extensions to the ANSI C standard.

Resources