Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

C99 has been with us for a while now. It introduces a lot of features that are not in K&Rs The C Programming Language. None of them are particularly radical. However, even small features like being able to intermingle declarations and code change how one organizes code.

While I still consider the K&R book an invaluable reference, and like its writing style, is there a better book that takes into account the C99 standard? I'd buy a third edition of K&R in a heartbeat, but I don't think that is going to happen.

share|improve this question

closed as off-topic by gnat, GlenH7, MichaelT, Kilian Foth, jwenting Sep 22 at 9:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, GlenH7, MichaelT, Kilian Foth, jwenting
If this question can be reworded to fit the rules in the help center, please edit the question.

    
There really isn't a C99 updated English version? The Czech translation of this book is updated for C99. –  Let_Me_Be Sep 8 '11 at 11:09
    
@Let_Me_Be The 2nd edition of the K&R book was published in 1988. There is no newer English version of the book. That edition covers ANSI C from 1988. –  Thomas Owens Sep 8 '11 at 14:09
    
Because of how the copyright/royalty is set up, K&R would not make anything by writing a third edition, which is why we haven't seen one yet. –  BlackJack Sep 8 '11 at 14:24
    
@BlackJack that's a real shame. –  Justin Dearing Sep 8 '11 at 14:26
1  
@Let_Me_Be - How much to get the Czech translation translated back to English? :-) I think it may be the only way we'll get a C99 version of K&R... –  voretaq7 Sep 8 '11 at 21:47

3 Answers 3

up vote 6 down vote accepted

I would still suggest (the ANSIfied second edition of) K&R for anyone who is just learning C and who wants to learn Straight Procedural C (minus objects). I'd double that recommendation if they intend to be hacking on *NIX kernel code one day as K&R truly has the "Unix Mentality" in a programming book.

Once they've grasped the basics of C syntax and have a reasonable idea of style you can introduce them to other references that talk about the C99 features and explain that it may change the way they organize what they write, but they'll have (generally) good habits from starting out with K&R (like doing declarations up front) and they'll be cognizant of the why behind doing something contrary to those habits -- I think you build better programmers that way.

share|improve this answer
1  
Doing declaration upfront is actually bad practice inherited from C89 style, variables should be declared right before they are first used. See for example the answer to this question –  Étienne Nov 14 '13 at 22:08
    
@Étienne By "up front" I mean "Variables should all be declared as early as possible within the scope where they will be used." which is basically what that other answer is advocating (or at least showing in its very simplified examples). I approve of what that answer is advocating, but you want to make sure new programmers realize that "Oh drat, I need a {counter, temp variable, etc.} - Let me just declare it here in the middle of my logic." is a Bad Thing because doing so wrecks readability like this other answer points out (at least IMHO it does) –  voretaq7 Nov 14 '13 at 22:45
1  
There is no consensus, I respectfully disagree that it is a bad thing, and a lot of people think it is a good thing to declare it in the middle of the logic, see also programmers.stackexchange.com/questions/56585/… –  Étienne Nov 15 '13 at 8:12
    
@Étienne That is your opinion, and you are certainly entitled to it, but to be blunt there's no way you're going to change MY opinion: I'm a cranky old Unix hacker and C coding style is very much a religious thing for me. Fortunately chances are neither of us will ever have to read the other's code :-) –  voretaq7 Nov 15 '13 at 8:16
    
Hopefully we won't ;-) –  Étienne Nov 15 '13 at 9:27

You want Harbison and Steele: "C: A Reference Manual"

It explicitly covers C99 and compares/contrasts to other flavors of C. I have found it super useful.

share|improve this answer
1  
To be fair, H&S is exactly what it says it is: a reference manual, and by itself isn't a great learning resource the way K&R is. –  John Bode Sep 8 '11 at 14:41
    
Agree! I think the OP is looking for a reference, however. –  Angelo Sep 8 '11 at 14:47

I'd recommend King's C Programming: A Modern Approach. It's thicker than K&R but still not particularly padded and the author points out what is and is not new to C99 as well as style tips and other such things.

share|improve this answer
1  
$95 on Amazon, whoah! –  Ernest Friedman-Hill Sep 8 '11 at 13:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.