K&R would be fine for this purpose, I think. As a more general introduction to C, I think it's still great, but really needs to be paired with something more modern if you're planning to actually develop applications in C.
Ask HN: Should I use K&R to learn C?
11–20 of 70 posts
Re: Ask HN: Should I use K&R to learn C?
#12K&R is a great book however I feel there are better books these days. My two personal recommendations are C Programming A Modern Approach by K N King (2nd edition) and Programming in C by Kochan. However the exercises in K&R are excellent so make sure you do them all. Actually the cost of K&R is justified just for the exercises IMHO. Also get Understanding and Using C Pointers by Richard Reese, it is a must have. Two…
Re: Ask HN: Should I use K&R to learn C?
#13There was a very good critique of K&R in Learn C the Hard Way that got taken down because of (IMO) undue backlash. The gist of it was that K&R ignores the safety problems in C and there is no discussion of the habits/constructs seasoned C programmers have developed to make sure their code is safe. Of course, many of those habits were developed after K&R, but that's why we need revisions and new sources. In its place,…
Interesting, last time I asked on various C boards about learning resources, Zed's book got ripped apart. http://www.iso-9899.info/wiki/Books
> Too many factual problems and a presentation that gets you to do things wrongly before being shown how to do it correctly, and not even always then.
Eh?? Isn't that the whole point of "Learn __ the Hard Way"? ie., by making mistakes and learning from them?
Re: Ask HN: Should I use K&R to learn C?
#14If you're serious about reverse engineering, you might consider learning assembly language and C side-by-side. Learn an assembly language (with the Art of Assembly Language Programming or similar) while working through K&R (or another introduction to C), but compiling everything with gcc -S and reading the assembly output (initially, compile with -O0; optimization will obscure the output too much). This would be slow…
Re: Ask HN: Should I use K&R to learn C?
#15That being said, the example code in the book is sometimes terse at the expense of readability (and security). I would try to pick up a more modern, and defensive, coding style from the web.
Re: Ask HN: Should I use K&R to learn C?
#16There was a very good critique of K&R in Learn C the Hard Way that got taken down because of (IMO) undue backlash. The gist of it was that K&R ignores the safety problems in C and there is no discussion of the habits/constructs seasoned C programmers have developed to make sure their code is safe. Of course, many of those habits were developed after K&R, but that's why we need revisions and new sources. In its place,…
Then maybe it would be a good idea to go ahead and read K&R and then afterwards read Zed's book?
To learn C -- I'd recommend LCTHW.
Re: Ask HN: Should I use K&R to learn C?
#17Additionally, LCTHW let me down significantly (regardless of what you think of the author).
If I could make two recommendations to you, the first would be that reading a text book will never make you good at C programming; like many other languages (or perhaps programming in-general with the exclusion of highly-academic languages), creating your own personal projects and learning as you go with a mentor to guide you is probably the single best way to become proficient.
Second, eventually, you should read the current Spec (or at least, the latest draft and all its TC). Before getting to that, if you are convinced that a text book would be helpful, go look at http://icube-icps.unistra.fr/img_auth.php/d/db/ModernC.pdf
All the best,
Re: Ask HN: Should I use K&R to learn C?
#18But, at this point in my life, I believe the K&R book is a good read if you are into the history of programming languages or going to write a book about your own language and want to avoid the bloat common in computer books. It is not a great modern C book and has not been updated in years. I wish this wasn't true, but pointing new programmers to that book in anything other than a historical context is just not serving them well.
It is really too outdated and does not cover the language as it is used or safe programming in the language. I'm not sure what the replacement is these days.
Re: Ask HN: Should I use K&R to learn C?
#19Earlier quoted context omitted.
Interesting, last time I asked on various C boards about learning resources, Zed's book got ripped apart. http://www.iso-9899.info/wiki/Books
The critique of ZedShaw's book appears to be > Too many factual problems and a presentation that gets you to do things wrongly before being shown how to do it correctly, and not even always then. Eh?? Isn't that the whole point of "Learn __ the Hard Way"? ie., by making mistakes and learning from them?
The main critique of Zed seems to be that he didn't say it was impossible to protect a C function from the caller. So what? There is a big difference between his suggested style and the style you'd get from an uncritical reading of K&R, even though neither is 100% safe from the caller.
Re: Ask HN: Should I use K&R to learn C?
#20A book I read alongside K&R was "Illustrating C" by Donald G. Alcock, even though it is out of print and quite hard to find I'd recommend hunting a copy down as it explains the concepts visually and for me, it was the only book that made things fall into place.
http://www.amazon.com/Illustrating-C-Ansi-Iso-Version/dp/052...