Good book to learn C

I'd like to learn C but I wanted to ask if anyone knows of a good book to start with. I came across some folks who said the best one is 'The C programming language, second edition' but some reviews said that it's not for beginners. I am learning Java and UNIX on my Mac and am familiar with programming, but I still consider myself a novice (I'm learning for fun and the intellectual exercise).

So if this book isn't the right one, what else can you recommend? And while I'm here, I thought that OS X came with a c compiler. Is that correct? I tried to search the man pages for the proper command, but couldn't find anything.

If this is not the proper forum for this post, I apologize. I wasn't sure where it ought to go, and whoever's the moderator, feel free to move it if necessary.

'The C programming language, second edition' -- YES!

It can be terse, but if you have a programming background it shouldn't be impossible. I learned C using the first ed many years ago. In my opinion it's all you need.

I second agama's opinion. Kernighan and Ritchie's The C Programming Language is a fine way to start. I learned C from the yellowing 2nd edition copy that I have right here.

From the back cover: "C is not a big language, and it is not well served by a big book." The main section of the book is only 189 pages (followed by reference material). Compared to 1000+ page programming tomes common today, this is remarkably brief.

This book will give you a solid understanding of the ANSI C language (C89 to be precise) and its standard library. Nothing more. It does not deal with kernel system call interfaces, compiler/toolchain instructions, etc, which is a good thing in my opinion. Because it concentrates on C, it has aged quite well.

The book uses a very clear writing style, so you should be able to digest the dense areas agama mentioned. Working through the provided exercises will help you here.

If you do decide to use K&R, make sure it's the 2nd Edition; using someone's 1st edition will teach you an older, pre-ANSI dialect that you'll only encounter in geriatric code (no offense, old timers ;)).

Whichever book you choose, once you've finished it and have spent some time hacking with C, you may want to peruse comp.lang.c Frequently Asked Questions and see how well you do with their questions. It'll help reinforce what you've learned and will probably teach you quite a few things regarding commonplace mistakes and unfounded assumptions.

Regards and good luck,
Alister

There is a good selection of books:
The Definitive C Book Guide and List - Stack Overflow

The C Programming Language - Second Edition By K&R

is where I have started, really a good book, provided you should do some research on examples rather just going trough them.

Thanks to you all. I think I'll start with that book. But I was wondering if any of you could also tell me if OS X comes with a C compiler, and if not, do you know where I could get one?

You have plenty of choices. gcc. gcc frontend feeding llvm backend. clang. I have access to an old OS X 10.4 (Tiger) machine and it came with an Apple build of gcc.

Some more info on compilers for Snow Leopard: Mac OS X 10.6 Snow Leopard: the Ars Technica review

Regards,
Alister