Sure! Knowing C can definitely help with your overall understanding of how things work. It's especially helpful when learning new languages. I uploaded a copy of K&R ANSI C for you. In my opinion, it's probably the best way to learn it. http://whitepaperclip.com/files/ansi_c.pdf Have fun!
This book have copyright and you can buy it in libraries.
Ask HN: Learning C
21–30 of 66 posts
Re: Ask HN: Learning C
#22Just about everybody who answers this will say that K&R is good, and I agree, but in addition to this I found that learning the basics of assembly was helpful. You can really see what's going on with the stack, what a pointer really is (pointers are really the only tough part about learning C, everything else will be the same old same old if you already know how to program), and the difference between a system call a…
I'd second this. In fact, Steve Yegge once said this about K&R ( http://steve.yegge.googlepages.com/ten-great-books ): This is an odd little book. It's frequently mistaken for an introductory programming book, which inevitably leads to frustration. It's not a good way to learn how to program; it expects that you're already familiar with machine architecture, assembly language, compilers, and at least one other high-l…
Re: Ask HN: Learning C
#23I made the most progress in C when I took a class on OSs. Mainly, we wrote systems programming sorts of things like a simple shell, our own version of malloc, a simple user-space thread library, and so on. This really gave me insight into how these things would be done for real. Also, writing something really linked-list-heavy gets you a feel for pointers really quickly.
[1]: I have K&R ANSI C and I found it very concise and well-written. It is probably one step up from the "raw newbie" class of books in terms of difficulty, but should feel just right for someone already acquainted with (an) other language(s).
Re: Ask HN: Learning C
#24Earlier quoted context omitted.
I'd second this. In fact, Steve Yegge once said this about K&R ( http://steve.yegge.googlepages.com/ten-great-books ): This is an odd little book. It's frequently mistaken for an introductory programming book, which inevitably leads to frustration. It's not a good way to learn how to program; it expects that you're already familiar with machine architecture, assembly language, compilers, and at least one other high-l…
C Traps and Pitfalls: http://www.literateprogramming.com/ctraps.pdf
Re: Ask HN: Learning C
#25Most other C books will just treat it as a stepping stone for C++ which is a different beast, and a few awful offenders will stretch it to Java!
To see a few Algorithm implementations in C, there is no better friend than Robert Sedgwich's polyglot tome; it's the applied Knuth volumes that everyone keeps on their desk (quickly swapped for the actual Knuth volumes when expecting hacker guests.)
Along with C materials you will also need Unix materials. The two are inseparable and fuel each other. You already have a decent Unix in your Mac, and your FreeBSD is the best of the Unix breed bearing the original blood. For that there are no better companions than the books by Richard Stevens, both for system and network programming.
For larger scale software engineering you will need a few small to mid projects of your own. You will deal with header file and Make dependency problems, a few unix and processor portability problems and a few other stuff. The solution to those problems along with a fat library of useful routines are found in "C Interfaces and Implementations" by Hanson. It's a literate programming text where source code is interwoven with prose documentation and it's very self evident.
Along with productive C programming you might need to look into the darker side of C and Unix and follow the papers of the hacking underground (yes, HACKING, dispute the terminology all you want, but I think some blackhats deserve the noble noun more than javascript and CSS jockeys.) Unix and C have plenty of Not-TODOs to motivate plenty of caution. Hoglun and McGraw's Exploiting Software is the canonical C-Do-Not text books.
If you want to read library source code, your FreeBSD source code should give you plenty to keep you busy. Start with the sources for the games; I spent an enjoyable summer porting Minix games to DOS and taught me allot. There is also "The Standard Function Library", or SFL, google it, it has the cleanest C sources you ever seen. Highly recommended.
And should you ever want to write a C compiler, like I attempted, here is some advice: implement Oberon instead. Everything you could possibly learn at 1/100th of the headache.
Just the 2 cents of a guy who will only write C code again if there was a gun to his head ;-)
Re: Ask HN: Learning C
#26Re: Ask HN: Learning C
#27A great resource I have enjoyed while brushing up my C skills has been CS107 at Stanford University on the web. http://www.stanford.edu/class/cs107/ You can find the lectures on academicearth.org, or on iTunesU if you prefer to download them that way. Jerry Cain is a great lecturer. I wish they'd post the assignments with the files they provide the students though. Maybe someday.
Re: Ask HN: Learning C
#28Work through, in order, (1) K & R (2) C interfaces and Implementations by David Hanson (3) Deep C Secrets by Peter Van der Linden (4) Advanced Programming in the Unix environment
Good Luck!
Re: Ask HN: Learning C
#29You should absolutely learn C. A good knowledge of C is a very valuable asset for all sorts of work, especially on Unix. Thankfully, C is straightforward to learn. The major concept you need to understand is pointers; once you've done that, there are some syntactic oddities to absorb (typedefs, function pointer syntax, arrays vs. pointers), and you should skim through the standard library (which is tiny compared to J…
Re: Ask HN: Learning C
#30A great resource I have enjoyed while brushing up my C skills has been CS107 at Stanford University on the web. http://www.stanford.edu/class/cs107/ You can find the lectures on academicearth.org, or on iTunesU if you prefer to download them that way. Jerry Cain is a great lecturer. I wish they'd post the assignments with the files they provide the students though. Maybe someday.