tags:

views:

809

answers:

16

After The C Programming Language by Brian Kernighan and Dennis Ritchie, some of the books most favoured by beginners turn out to be ones best avoided, such as anything by Herb Schildt or even the O'Reilly Practical C Programming, and there doesn't seem to be much alternative to these. Otherwise most of the material available is about C++.

Besides K&R and the excellent C: A Reference Manual which I have already, what other books are the best to use for learning to code in C, (plain C89 and not C++), without learning bad practices along the way?

+10  A: 

Peter van der Linden's Expert C Programming: Deep C Secrets

Whatever
+5  A: 

I'd say to eschew the books entirely. Pick a project, any project (although not too large), and implement it in C. There's no substitute for simply jumping in and doing it. K&R gives enough knowledge that you can begin stumbling along and gaining the experience that makes for true good learning.

McWafflestix
The question is asking "good C books to read" not "how to learn C". I'm already working on some small projects (and referring to source code via Google's codesearch), but I also enjoy reading up/around on what topics are relevant to what I'm currently trying to do, or hoping to do.
Rob Kam
+5  A: 

This explains why Schildt is bad. Some more criticism here.

Search SO for C resources.

dirkgently
+8  A: 

C: A Reference Manual by Harbison and Steele

It's not a tutorial book, but it's hands-down the best book on C (even over K&R in my opinion). Used in conjunction with K&R (or any other tutorial), you'll get a great foundation in C.

Michael Burr
Rob Kam
A: 

I might also recommend reading C programs. Sadly I haven't done enough of this myself to recommend particular ones.

Justin Love
I was considering adding this to my response, but I think this might be a bit misleading. While C can be a great language for implementation, it also can be a magnet for some terrifyingly crappy implementations; even among some of the best C code, there can be some remarkably unclear and obtuse code. I think for learning C in particular, "doing" is more valuable than "reading".
McWafflestix
I would have included 'doing', but it had been mentioned already.
Justin Love
+1  A: 

I like Pointers on C by Kenneth A. Reek. I won't do so far as to say it's better than K&R but I certainly found it more friendly and easier to learn from. I started with K&R, but didn't really get a hang of C until I picked up this book.

Edit: I also just found out that the price of this book has skyrocketed since I bought it. So while my recommendation still stands as such, I cannot really recommend it at the current asking price. So if you can find a used copy or a copy at a library then it's worth getting, but at its current price there are other books that are basically just as good for a lot less money.

Expert C Programming is book I consider worth at least looking through once you've gotten the hang of C, although I'm hesitant to outright recommend it. On the plus side it contains a number of good tips and tricks and some very useful advice. On the minus side those tricks and pieces of advice are badly organize, buried among not so useful advice and half the book seems filled with lame jokes, asides and irrelevant (but occasionally amusing) stories. So I'd borrow it from the library, but not pay money for it.

But as you no doubt realize, you'll never really learn C until you write C.

Pointers on C is easily the most expensive to buy.
Rob Kam
@Rob: Wow, when did that happen? It's been several years since I bought mine, and I bought it in England, but I don't recall it being more expensive than any other programming book
Unfortunately it's £75.72 from amazon.co.uk, I'd want to be convinced it's worth it for that price.
Rob Kam
Well it's a great book and all, but too be honest I wouldn't pay £75 for it.
A: 

I agree with McWafflestix, best way to learn any programming language is to just jump in to a project, and look up things as you need them. This is how I've learned... around 4 languages I think? And it's worked consistently.

Cheers!

Michael
+5  A: 

I would be tempted to read Practice of Programming and Programming Pearls. Both are quite terse books and C orientated

Fortyrunner
Practice of Programming is excellent second book. Programmin Pearls is a bit more advanced, IMHO.
Laurynas Biveinis
+1  A: 

Beginning C by Ivor Horton (3rd edition) from APress is a great introductory book on C programming. This book is very thorough and is not a reference book but a good tutorial from start to end on everything in the C language.

Beginning C by Ivor Horton (3rd Edition)

Ralph
I seem to have read somewhere that he uses int main (void) throughout, with no mention of int main(int argc, char *argv[])?
Rob Kam
He does use int main(void) regularly in the beginning which is a valid declaration according to the ANSI C standard. Later, on page 349 he introduces the main(int argc, char *argv[]) declaration.
Ralph
A: 

There are some brief but helpful reviews at (the Russian mirror of) the ACCU, for beginner's C and for advanced C.

Rob Kam
+4  A: 

K&R essentially covers everything you need to know about C, and even implements a few data structures that are commonly used. If you're using *nix and want to learn how to take advantage of the operating system, Advanced Programming in the UNIX Environment, Second Edition is a good reference/guide to common uses such as reading a file, creating threads, etc. Sample code is in C.

mgriepentrog
A: 

K&R is also not the current version of C. ISO or ANSI C is.

Steven Behnke
htw
+1  A: 

A great book to learn C is: C BY DISSECTION The Essentials of C Programming by Al Kelley & Ira Pohl

Very easy to read wth lots of great programming examples.

mrwes
A: 

Pick up your K&R book again, and this time do the exercises. Then compare your code with the code in K&R and see if it has similar elegance in the function interfaces and data structures. This isn't a book to read through quickly and go to the next book. It contains a lot of valuable information, and the exercises will help you to realize some of them that you probably missed on the first reading.

dwc
+2  A: 

C unleashed.

Bastien Léonard
+1  A: 

The best textbook on C I have is C: A Software Engineering Approach by Peter A. Darnell and Philip E. Margolis. While it is (undeservedly) not as famous as other books, I found it very readable and it handles all the details K&R skips over.

It has two disadvantages though:

  1. It is from 1996, so it does not cover C99. (This should be fine with you since you are interested in C89.)
  2. It is quite expensive.

Edit: Another book of interest is C Programming FAQs by Steve Summit. While I don't have this book in print, the accompanying web site helped me a lot in understanding the less obvious features of C.

Jochen Walter