What are must read books for entry level C programmer?

45 points by simsalabeam ↗ HN

26 comments

[ 1.5 ms ] story [ 70.4 ms ] thread
It's not called the bible for nothing.

Anecdotally:

Going into college, my only coding experience was in HTML and a month of fiddling with BASIC ten years earlier.

I picked this (required reading) up a month ahead of my first CS class and read the first few chapters on my own. Even though I didn't have a computer to compile on, it gave me a huge advantage going in compared to others who had never programmed before. (Though not nearly as much as those who had taken classes in high school.)

Edited to add:

It will give you a good introduction to the language, but to an older standard. I haven't written C since college. My possibly wildly incorrect understanding is that code written to this standard will compile and run as intended on more modern compilers and systems, but the book won't introduce you to more modern features and conventions.

SICP
Great book, but it doesn't teach C, unless there's a version I'm unaware of.
# Deep C programming

http://www.amazon.com/dp/0131774298/?tag=akhn-20

Talks about all the weird historical C design decisions.

# 21st century C programming

http://www.amazon.com/dp/0131774298/?tag=akhn-20

Discusses the language and some of the best practices.

21st century C programming, as I recall, will get you set up a dev environment with tooling, which can be hard for an entry level C programmer. It also covers useful tools and libraries.

It's also a fairly good C book in general, though I don't know that I'd want to try to learn a computer language from it.

I'm a big fan of older programming books, and one of the favourites in my collection is Thomas Plum's 'Reliable Data Structures in C' book from way back when (1985!).

While it pre-dates ANSI C and contains a few quirks you wouldn't necessarily want in production code, I found the book to be a lucid and fantastic resource to help explain how data structures work in C, as it gives hands on applications through the building of a working piece of admin software (albeit a slightly outdated one!).

If you're aware of how pre-ANSI C differs from C89/99 et.al with regards to function and parameter declaration, it's worth buying a used copy on Amazon just to leaf through - there are copies going for a single cent (plus shipping) at the moment.

His first book 'Learning to Program in C' is also great reference to read alongside K & R (which should be mandatory reading for anyone looking to learn C, not necessarily for the code style or examples but to get a handle on the ethos of the language).

(comment deleted)
I would like to recommend this book[0]. By reading this book, you will be able to grok C. You'll learn how your C programs interact with the hardware. Learn about the stack and how it is used in calling functions. Learn about pointers and how it is represented in assembly language. Learn how arrays in C and how it is accessed in memory. And many more! I keep recommending this book because this had enlightened me in understanding how computers work and I wouldn't get tired of recommending this. If you read just half of the book, you'll gain confidence especially during coding interviews. This was my experience though. Believe me.

[0] - https://www.amazon.com/Assembly-Language-Computer-Architectu...

Zed Shaw's "Learn C the Hard Way" is a rather good intro to C for systems programming.
I understand this criticism from experienced C programmers, and yes Zed doesn't always give a strict-standard accurate account. But for a total novice, the approach of broken thing, figure out why it's broken, fix it, is very powerful. After all, this is the bulk of dev work.

Additionally, Zed pays special attention to defensive programming, an often forgotten art and good practice.

Seriously? No one has mentioned K&R. It's arguably the best programming book ever written.
Yes, see the pixpop post.
It's also seriously out-of-date. C has changed a lot since 1988, mostly for the better.
>It's arguably the best programming book ever written

Well that is debatable and many people might not agree with you (though I tend agree and put it near, if not at the top of my own list).

As they say, De gustibus non est disputandum:

https://en.wikipedia.org/wiki/De_gustibus_non_est_disputandu...

Along with K&P, makes for two of the best, and where Kernighan was a co-author, IMHO.

Of course, caveats apply and should be mentioned (a few others have said it), such as it not being up to date with latest versions of the C standard. But that does not diminish the achievements or quality of K&R.

Edits for grammar / wording.

However I don't think it is necessarily the best first book on C for everyone, but it can be for some. Depends on the amount of systems-level and close-to-the metal knowledge they have; at least a minimal understanding of how computers work under the hood (RAM, hard disk, CPU, files, etc. [1]), or at least a mental model of that, helps and those who have that will do better with K&R as first book. Others may be better served by an easier book and then should move on to K&R.

[1] And some people, even on here, may be surprised at how much some people are lacking in that sort of knowledge, more so in these days of Android and Apple tablets and smartphones, where a lot of the underlying details of computers (both on hardware and software) are abstracted away. Very different from the age of hobbyist home computers, where you had to know a good amount about the internals to use the things, as some many comments in recent threads here about them have mentioned.

"C Interfaces and Implementations: Techniques for Creating Reusable Software" by David Hanson.

After K&R, but still early in your C career.

CS:App you can find it used/cheap on Abe books. You probably want the 3rd version that covers x86-64.

Look at the TOC it covers floating point, TMin/Tmax overflow and casting to unsigned problems, gcc use, assembly (enough to understand how exactly pointers work) and many other things including VM/CPUs/Cache memory ect http://csapp.cs.cmu.edu/

The book Hacker's Delight 2 picks up from here and shows you all kinds of bitshifting tricks and other C specific optimizations, The Art of Software Security Assessment to show you safer C and Robert Seacord's book on The CERT C Secure Coding Standard.