Hacker News new | ask | show | jobs
by screwperman 6261 days ago
I'd second this. In fact, Steve Yegge once said this about K&R ( http://steve.yegge.googlepages.com/ten-great-books ):

This is an odd little book. It's frequently mistaken for an introductory programming book, which inevitably leads to frustration. It's not a good way to learn how to program; it expects that you're already familiar with machine architecture, assembly language, compilers, and at least one other high-level language.

It's not even a very good way to learn C. The idioms and best-practices for C programming have evolved substantially, even since the second edition was published, and some of the code samples look a bit dated.

As the parent said, you'll appreciate C only if you learn about machine architecture and Unix. Diving into a large codebase will get you acquainted with "modern" C.

I've found the book C Traps and Pitfalls to be the book to get you to think like a C programmer. The C Puzzle Book is pretty good for exercises, and Expert C Programming does a good job exposing the ugly side of C.

3 comments

I know the plural of anecdote is not data, but my personal experience was the opposite. C was the first programming I learned and I learned it by reading K&R in high school. I certainly didn't know anything about assembly, compilers, or another high-level language.

From there I learned by contributing to open source projects.

Not saying K&R is the best way, but it's not so opaque that a beginner with zero knowledge of C (or even programming) can't pick it up and learn if they're motivated to learn it.

K&R was the only C book that ever allowed me to pierce the veil of mystery surrounding C and understand it. I'd tried at least a half dozen other books and was either bored out of my mind at the painfully slow pace, or utterly baffled around chapter 2 or 3 where it leapt into pointers and seemed to just assume it was obvious.

For whatever reason K&R was a perfect storm of comprehension for me, and I came away actually knowing how to read and even sort of write C (and knowing how to search the Internet, pre-Google, or ask reasonably smart questions on the mailing list or IRC channel of the software I was working with, for answers to the harder questions). I failed miserably with every other book on the subject.

If you enjoyed reading those 29 pages, you might find the entire book a decent read as well: http://www.amazon.com/C-Traps-Pitfalls-Andrew-Koenig/dp/0201...
Agreed. I was scared of C for a long time, but it's actually a beautiful language. Deitel & Deitel's 'C; How to program' is a fine tutorial in both C and structured programming. YMMV.