Introduction and Overview






Introduction

This tutorial is designed for people who have never programmed before in any language, let alone C. As such, there will be sections that repeat basic programming ideas that people with some programming experience will want to skip. To this end, I have tried to make the outline as detailed as possible. Also, this tutorial is not designed to make you a C guru. I have just attempted to lay out the basics of the language. For more information, there are very many good books on C out there.

Before you can run any programs you write, you will need a compiler. For most systems, you can find a version of gcc (the GNU C compiler) at their website. For the MacOS, you can download Apple's own compiler MPW. All compilers are a little different, so you may have to play around with it before you can make it work exaclty the way you want it to. As for which platform to write your code on, I have found that any UNIX based computer makes it easiest. Most UNIX machines have gcc already installed (ask your sysadmin), and text editors like Emacs make good spacing and indentation easy. You may also want to find a debugger. For UNIX platforms, I would recommend gdb, the GNU debugger.

Why Program in C?

I'll answer this question instead of "why program at all?" because if you were wondering that, chances are you wouldn't be here! C is a very versatile language that has become almost an industry standard. A large portion of the commercial applications available today were written in either C or its extension C++. Because of this, a knowledge of C is a very useful thing to have. C is also a fairly low-level language, and so learning C will help you to begin to understand how memory structures within the computer work. C is not the right tool for all projects; but for a large number of applications, C works very well.

Credit Where Credit's Due

I learned C from CS 21 taught by Jim Marshall at Swarthmore College. The text we used was The Art and Science of C by Eric S. Roberts. I recommend this book; I found it to be clear and informative. I'm sure I was heavily influenced by it in the way I'm presenting this material here. Everything that I didn't learn from this class, I learned by messing around on my own :).



Back to the Outline   On to Section 1: The Basics