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?

Community
  • 1
  • 1
Rob Kam
  • 10,063
  • 14
  • 55
  • 65
  • Why not K&R? Was this just an excuse to bad-mouth some books you didn't like? – Andy Mikula Apr 29 '09 at 18:01
  • 4
    Andy, Schildt is /famously/ bad. – tpdi Apr 29 '09 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." http://www.seebs.net/c/c_tcr.html – tpdi Apr 29 '09 at 18:08
  • The wording is unclear, but I don't think Rob was saying K&R is bad. – millimoose Apr 29 '09 at 18:18
  • @tdpi: Fair enough! I did a bit of reading and honestly I'm intrigued enough to try to find one of his books. @Sii: I don't think so either - I'm just wondering what more he's looking for in a book, I guess! – Andy Mikula Apr 29 '09 at 18:32
  • 1
    O'Reilly's [_21st Century C: C Tips From the New School (2nd ed.)_](https://www.safaribooksonline.com/library/view/21st-century-c/9781491904428/toc01.html) (2012) by Ben Klemens is awesome. – Geremia Jan 18 '17 at 23:40

14 Answers14

22

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

Whatever
  • 590
  • 3
  • 4
  • 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. – Mike Nichols Feb 27 '12 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.

Michael Burr
  • 333,147
  • 50
  • 533
  • 760
  • 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 Apr 29 '09 at 20:27
8

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

Search SO for C resources.

dirkgently
  • 108,024
  • 16
  • 131
  • 187
8

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

Fortyrunner
  • 12,702
  • 4
  • 31
  • 54
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.

mgriepentrog
  • 466
  • 3
  • 10
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.

Paul Sonier
  • 38,903
  • 3
  • 77
  • 117
  • 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 May 03 '09 at 07:06
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.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
dagw
  • 2,568
  • 4
  • 20
  • 21
  • Pointers on C is easily the most expensive to buy. – Rob Kam Apr 29 '09 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 Apr 30 '09 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 Apr 30 '09 at 18:31
  • Well it's a great book and all, but too be honest I wouldn't pay £75 for it. – dagw Apr 30 '09 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 Nov 29 '10 at 15:39
  • This book is very good. It even has a chapter on function pointers! It also goes into detail about compilation and memory management, even showing the assembly code corresponding to the C! However, it doesn't cover threads. K&R doesn't go into much depth regarding function pointers, and not at all regarding threads. – Geremia Jun 11 '15 at 19:34
3

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
  • 24,196
  • 7
  • 44
  • 55
3

C unleashed.

Bastien Léonard
  • 60,478
  • 20
  • 78
  • 95
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)

Ralph Caraveo
  • 10,025
  • 7
  • 40
  • 52
  • 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 May 04 '09 at 07: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. – Ralph Caraveo May 04 '09 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.

mrwes
  • 639
  • 1
  • 8
  • 18
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.

Jochen Walter
  • 1,420
  • 11
  • 10
0

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

Justin Love
  • 4,397
  • 25
  • 36
  • 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". – Paul Sonier Apr 29 '09 at 18:40
  • I would have included 'doing', but it had been mentioned already. – Justin Love Apr 30 '09 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.

Rob Kam
  • 10,063
  • 14
  • 55
  • 65