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?

6
  • Why not K&R? Was this just an excuse to bad-mouth some books you didn't like? Commented Apr 29, 2009 at 18:01
  • 4
    Andy, Schildt is /famously/ bad.
    – tpdi
    Commented Apr 29, 2009 at 18:03
  • 1
    Pete Seebach has this to say about one of Schildt's books: "C: The Complete Reference is a popular programming book, marred only by the fact that it is largely tripe. Herbert Schildt has a knack for clear, readable text, describing a language subtly but quite definitely different from C. This page aims to give people a good way to find out what's wrong with it." seebs.net/c/c_tcr.html
    – tpdi
    Commented Apr 29, 2009 at 18:08
  • The wording is unclear, but I don't think Rob was saying K&R is bad.
    – millimoose
    Commented Apr 29, 2009 at 18:18
  • 1
    O'Reilly's 21st Century C: C Tips From the New School (2nd ed.) (2012) by Ben Klemens is awesome.
    – Geremia
    Commented Jan 18, 2017 at 23:40

14 Answers 14

22

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

1
  • 1
    Agreed. This is not only a very well-written book that will teach you a lot about the more arcane corners of C, but also hilarious and a very entertaining read. Commented Feb 27, 2012 at 22:00
12

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.

1
  • Yes this is a must have C book. I should have included it in the question along with K&R, and have done so now.
    – Rob Kam
    Commented Apr 29, 2009 at 20:27
8

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

Search SO for C resources.

1
8

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

1
  • Practice of Programming is excellent second book. Programmin Pearls is a bit more advanced, IMHO. Commented Apr 30, 2009 at 9:20
7

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, Third Edition is a good reference/guide to common uses such as reading a file, creating threads, etc. Sample code is in C.

2
  • K&R doesn't cover threads or anything specific to C11.
    – Geremia
    Commented Jun 11, 2015 at 7:25
  • K&R also doesn't go into much depth regarding function pointers, either, but this voluminous work does.
    – Geremia
    Commented Jun 11, 2015 at 19:35
6

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.

1
  • 1
    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
    Commented May 3, 2009 at 7:06
4

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.

0
4

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.

6
  • Pointers on C is easily the most expensive to buy.
    – Rob Kam
    Commented Apr 29, 2009 at 19:30
  • @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
    – dagw
    Commented Apr 30, 2009 at 10:16
  • Unfortunately it's £75.72 from amazon.co.uk, I'd want to be convinced it's worth it for that price.
    – Rob Kam
    Commented Apr 30, 2009 at 18:31
  • Well it's a great book and all, but too be honest I wouldn't pay £75 for it.
    – dagw
    Commented Apr 30, 2009 at 19:08
  • I agree, it's a great book. I found my used copy (like new) a year ago on www.bookfinder.com for only 25€.
    – Jogusa
    Commented Nov 29, 2010 at 15:39
3

C unleashed.

1

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)

2
  • 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
    Commented May 4, 2009 at 7:06
  • 1
    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. Commented May 4, 2009 at 16:57
1

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.

1

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.

0

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

2
  • 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". Commented Apr 29, 2009 at 18:40
  • I would have included 'doing', but it had been mentioned already. Commented Apr 30, 2009 at 22:29
0

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

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