Weblog entry #1 for nole

How do you learn C?
Posted by nole on Thu 1 Feb 2007 at 13:13
Tags:
My most noted new-years resolution might have been to get in a bit better shape then I was 2006 but I have one more and that is to learn how to code in C. I have bought K&R by advice from more experienced people and it's a good book that I have just begun reading chapter two of, but if you have any knowledge that would make a C newbies life easier I promise that they will be much appreciated.

 

Comments on this Entry

Posted by Anonymous (213.164.xx.xx) on Thu 1 Feb 2007 at 15:39
Stop reading, start coding.

[ Parent | Reply to this comment ]

Posted by Steve (62.30.xx.xx) on Fri 2 Feb 2007 at 02:56
[ Send Message | View Steve's Scratchpad | View Weblogs ]

Harsh but probably the best plan.

Probably best to pick a small toy project, such as a simple program which parses command line arguments, or maybe fetches a remote webpage, and just write it.

Google code search is a good thing if you need big help, but the K&R book is very well written. Read it through if you can, with the examples - the reading will help but the doing will teach you more.

Steve

[ Parent | Reply to this comment ]

Posted by simonw (84.45.xx.xx) on Fri 2 Feb 2007 at 17:00
[ Send Message | View Weblogs ]
... and running code analyzers on the code you write.

Discovered the author of the book I learnt C from didn't know much about secure coding (or if he did, he didn't share it). Although I assume K&R should escape this failing, I wouldn't want to bet on it.

[ Parent | Reply to this comment ]

Posted by mcphail (62.56.xx.xx) on Fri 2 Feb 2007 at 20:42
[ Send Message ]
Aah, "C - The Complete Reference" by any chance?

[ Parent | Reply to this comment ]

Posted by simonw (84.45.xx.xx) on Fri 2 Feb 2007 at 21:16
[ Send Message | View Weblogs ]
No, it was a beginners guide, that covered little more than syntax, and a few basic libraries.

I seem to have thrown it out at some point, so the author is spared blushes.

[ Parent | Reply to this comment ]

Posted by busfault (69.205.xx.xx) on Sun 4 Feb 2007 at 18:41
[ Send Message | View Weblogs ]
I would say books can be okay, I prefer the O'Reilly 'Practical C Programming' book, but to each their own when it comes to books. The next thing is to take a program that you have written in another language (unless C is your first language) and write the progam in C, you may think that this is redundant, but you know how that program is supposed to work in the other language, you can use it to compare outputs, behaviour, etc. If you don't have a good example program of another language for what ever reason. I would say make up a programming problem for youself to solve. Start simple then move to complex. (eg Take two inputs, multiply the values, spit back out the result) Some books have problems in them, you could also scrounge the web, (university CS department sites are good) for projects.
Another way would be to download open source code in C and explore it, modify stuff see what happens.
As with most learned things, the best thing to do is practice, practice, practice.

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search