Any recommendation for a good, free resource to learn the fundamentals of C (not C++) development covering basic topics such as Algorithms, Control Structures, Functions, Arrays, Pointers, Structures, et cétera?
views:
645answers:
12I'm a firm believer in the K&R C book, 2nd edition: http://netlib.bell-labs.com/cm/cs/cbook/ - it covers all of the subjects you've mentioned here, and more.
This book is popular enough where it should be easy to find at your local library, if by free you meant "free as in beer."
I know this is not exactly what you asked for, but: Go to your local library and find a copy of K&R. That's all you need to begin learning C. And libraries are free :). If your local library doesn't have it, move to a bigger city!
Whilst not really free, can I point you to the 'defacto c reference' the Kernighan and Ritchie book: The C Programming Language
The best programming book Ive ever read (and small too).
There is an online version of The C book available. http://publications.gbdirect.co.uk/c_book/
I recommend, despite (or maybe because of) the long history lesson, starting with the wikipedia page and then considering a link to one of the free sources at the bottom.
Wikipedia: http://en.wikipedia.org/wiki/C_programming
A link to the now-free "C Book" at the bottom of the wikipedia page: http://publications.gbdirect.co.uk/c_book/
Wikipedia's getting rich enough that I often go to it first to see if it covers a topic, since it's outlinks are often of better quality... failing that I go to a search engine.
Later addition:
I don't yet see mention of this here (free tutorials via the web):
http://www.cprogramming.com/tutorial.html
and more generally http://www.cprogramming.com.
Since everyone mentioned the K&R book I'll add two different ones.
1) The Standard C Library by P.J. Plauger - I like this book because the code is real. Hello world examples will only get you so far.
2) Advanced Programming in the Unix Evironment by Stevens - This assumes of course that you're developing on the Unix platform but C by itself isn't going to do anything really interesting like sockets. For that you need to learn about POSIX, much of which is covered in this book.
I found this to be a very enlightening resource:
Object-Oriented Programming in ANSI C (PDF)
This isn't a general C reference guide, but it does a really neat job of explaining how you can apply well-known object-oriented principles to C.
The "C Book", linked to above, is probably enough to get you started. Also, while not a tutorial per-say, the C FAQ is a great resource for beginner and intermediate C programmers. It was amassed over a period of almost two decades and it answers the most common questions new C programmers have. Most C books (including K&R 2) are quite old, and ignore a subject no C programmer today an afford to: security. Once you know C, the US CERT Secure Coding Standard can help you develop secure software.
These are two additional tutorials, but I haven't read either of them, so I can't speak to their quality:
The K&R book is a little daunting for people who have trouble grasping code like
while (*c++);
and its subtleties at a glance. It's a great book if you already know C and would like to know it better.
I would recommend learning C from a real person with years of experience. I learned from an excellent professor and a copy of C Programming: A Modern Approach by K.N. King.
ioplex mentioned Advanced Programming for the Unix Environment by Stephens. I would have to back him up. Advanced Programming is a very handy approach to C and covers almost every aspect of *nix in a way that does not leave you saying "What can I do with C besides code a F to C temperature application?". However, I would not recommend it as a "first C book".