tags:

views:

1062

answers:

8
+26  A: 

The book only covers the 1989/1990 version of the C standard. The current standard is from 1999. However, the 1999 version is still not widely used, so the K&R 2nd edition is still highly useful.

Moreover, it's still highly enjoyable.

Lars Wirzenius
This must be some new definition of the word "enjoyable" that I was not previously aware of :-) Still, +1 for pointing out the C99 difference.
paxdiablo
Nice H2G2 reference, Pax. I love that line.
Chris Lutz
kmarsh
+2  A: 

It covers the C language as standardized by ANSI in 1989. There was an update to the language ('C99') in 1999, although compiler support for it is generally spotty and the original ANSI standard of the language is the safest way to use C in a portable fashion.

Volte
+4  A: 

I think the latest version of the K&R book was published in 1988. There have been some enhancements to C since then, such as the changes for "C99."

The K&R book is still probably THE resource for C, despite the new additions. Here are a few links that might help point out the new additions:

Andy White
+32  A: 

It isn't current, it is eternal.

chaos
-1, not a real answer
hasen j
Let he who has ears, hear.
chaos
It's just a programming language and I doubt it'll still be used in 100 years.
siride
@siride: Two-digit years are just fine.
Nicholas Knight
+12  A: 

It covers C89, it is a must read but C99 introduced several new features, many of which had already been implemented as extensions in several compilers and they are widely used:

  • inline functions
  • variable declaration no longer restricted to file scope or the start of a compound statement
  • several new data types, including long long int, optional extended integer types, an explicit boolean data type, and a complex type to represent complex numbers
  • variable-length arrays
  • support for one-line comments beginning with //, as in BCPL or C++
  • new library functions, such as snprintf
  • new header files, such as stdbool.h and inttypes.h
  • type-generic math functions (tgmath.h)
  • improved support for IEEE floating point
  • designated initializers
  • compound literals
  • support for variadic macros (macros of variable arity)
  • restrict qualification to allow more aggressive code optimization (http://en.wikipedia.org/wiki/C99)
dfa
+5  A: 

As others have said, K&R covers C89 (C90), and not C99, but it remains a very good book indeed.

For a detailed view of C99 after reading K&R, use C: A Reference Manual (5th Edition).

Jonathan Leffler
Michael Burr
+1  A: 

I personally have three copies K&R on my shelf, and use them often. It's still the go-to book for a surprisingly wide range of questions.

But it is showing some age. C99 != C89 in several details, but I think the more important differences are in how our style of programming has evolved in the last twenty years. There are standard libraries like glibc to do many of the things that used to be re-implemented and re-re-implemented by C programmers of old. Depending on your situation, you probably don't have to carefully manage every byte of memory, meaning that modern code has a fraction of the malloc()ing that older code had. Changes in focus such as those make some (not all) of K&R look a little obsolete.

For learning modern C, I recommend Modeling with Data, which is available from that link in PDF or from Princeton Press as an actual book. It's primarily about scientific computing, but the first half gives a thorough and reasonably general intro to C from the modern perspective.

+2  A: 

If you are looking for latest book on C.

Reference style book: C: A Reference Manual - Samuel P. Harbison and Guy R. Steele

Beginner level book (with detailed explanations): C Programming: A Modern Approach, 2nd Edition - K. N. King

claws