Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is "K&R C" still applicable [closed]

Tags:

c

I relearning C; it's been years and whilst familiar the nuances are lost in time.

I originally learned C from K&R. However, I now see many people levelling criticism at K&R.

A chief example is http://c.learncodethehardway.org/book/learn-c-the-hard-waych55.html#x61-27200055

Top reasons seem to be that it's code style is overly terse, practises aren't applicable in larger programs and lead to memory leaks or are subject to attack in shared network accessible systems.

Do people feel these criticisms are fair? Do they matter to somebody learning C? If so, could people recommend a "modern" C book, preferably available for Kindle?

like image 636
retrodev Avatar asked Dec 12 '11 17:12

retrodev


2 Answers

As long as you're talking about the 2nd Edition, K&R is still very relevant.

In fact, I would say it's still the very best single book on C, both for learning, and for reference.

That said, you should also get a copy of Harbison & Steele's "C: A Reference Manual". It's the best current reference on C, and the Fifth Edition covers C99, which you should use if you can.

Also, once you've got a bit of C behind you, I'd strongly recommend reading "Expert C Programming", by Peter van der Linden.

like image 180
Greg Jandl Avatar answered Oct 31 '22 00:10

Greg Jandl


It is still relevant and still very useful with regards to learning the language. Learning the language doesn't require you to implement new practices or styles that assist in code readability, etc.

For example, the idea of self documenting code is that you use verbose variable and function names to help explain the purpose of a function or a variable. K&R is clearly opposed to this. That doesn't mean you can't learn the C language from K&R, it just means that your style will need to be adjusted/updated based on whatever naming convention you decide upon in the future.

I cannot recommend "Expert C Programming" enough (as stated by gregj).

like image 3
Brett McLain Avatar answered Oct 31 '22 01:10

Brett McLain