The C Programming Language
[added 8/31]: CodePad is a site that lets you paste or type in C code, compile it, and see the output within your browser. It then gives you a URL you can use to share the code with others. It could be a good tool for sending code to an instructor or TA via email, as he or she will not have to download and compile the code to help you. It supports several languages beyond C as well.
Tutorials
You all know Java or C++ already (if I'm wrong about that, let me know), so any "how to program" tutorial is not well targeted for you. Unfortunately, perhaps because C has historically been a first language, I don't know of any C tutorials for people who already know how to program. The "how to program [in C]" tutorials will have to do. Fortunately, it is easy enough to run through the concepts you already know (program control, conditionals, loops), picking up the syntax changes as you go, without wasting much time.
I recommend first quickly skimming over all of the tutorials to get a sense of their styles and the sequence of topics covered in each. Then, start with the first or second tutorial in the list (they get directly into coding the fastest), and refer to or switch over entirely to other tutorials as you go.
- C Language Tutorial — Eases into the language nicely, but doesn't cover as many topics as some of the other tutorials.
- C Programming Tutorial — Nicely organized and presented, but it doesn't have many complete examples. It might work well to use this one to quickly read about a particular concept, then refer to a different tutorial to get a more wholistic view of that concept.
- C Made Easy — This tutorial has small quizzes at the end of each section to help you test your knowledge. The site also has several other references for C, but it's distractingly heavy on the ads.
- This section on Pointers from another tutorial is fairly good, with diagrams illustrating how pointers and arrays work in memory.
Reference
- Man pages are your friend. On most unix-like systems, there is a separate man page for every function in the standard C library. Running man 3 [function] from the command line will bring it up (e.g., man 3 printf). The 3 is necessary so that you don't get a man page for a shell function or program with the same name (to see, try running man printf instead). They're also available online in several places, such as here.
- C Reference Card — This is a very handy reference card with all of the basics of C. Once you've run through a tutorial or two, this will probably be enough to refresh your memory in most cases.
- The C Library Reference Guide — A good reference for both the language itself and the standard library of functions.
- comp.lang.c Frequently Asked Questions — "comp.lang.c" is a usenet newsgroup (an ancient internet service at this point, now generally disused and overrun with spam) dedicated to the C programming language. Like the name says, this site is a great set of answers to questions, problems, and confusions frequently encountered when programming in C. It's worth skimming through each category to get a feel for the kinds of questions in each. Then you can refer to it later when you run up against something that you think you might have seen when skimming.
- [added 8/25]: Probably the best reference for anyone coming out of CS128 and/or with a Java background is Learning C From Java. The name is self-explanatory. (A hint for reading it: If you come across something that you haven't learned in Java, then it's probably safe to skip that part.) This is more of a reference than a step-by-step guide, so the tutorials are still going to be useful.
- [added 8/25]: Another good reference in a similar vein that covers C++ as well is here. It has a convenient table summarizing the differences.
- [added 8/31]: The website for an IRC Channel devoted to C has lots of good resources, including links to tutorials, both general and topic-specific, C gotchas that trip up beginner C coders, and lots of helpful snippets about particular topics like I/O and converting strings to numbers, etc.
- [added 9/9]: This PDF is a good resource for implementing linked lists in C. It describes several approaches, with C code for all of them.
Unix and the Command Line
There are many "flavors" of Unix. OS X is one; Linux (like on sun.iwu.edu) is another. They all share common commands and utilities, though, so a tutorial written for one is often applicable to the others.
I would recommend going through all of these, actually. As you learn, you'll become more and more comfortable with the shell, and the second tutorial will fly past, so it shouldn't take too long.
Return to the syllabus