If you wish to read the notes for my 2009 C programming for beginners class,
Welcome to the Unix and C EXCO class website!
Here you will find resources for the Linux operating system as well as the C programming language.
Links to my C references
- Week 1
Getting a C Compiler for your system
In order to test the skills you learn with regards to C, you'll need to be able to compile your own C programs. Luckily, there are numerous free C compilers for many different operating systems.
For Windows I would recommend the MinGW C compiler. This is a native Windows port of the GNU C Compiler used on Linux. Download links below:
- MinGW Home Page
- Direct Download Link for MinGW
If you prefer to have a graphical IDE (Integrated Development Environment), then I would recommend that of Bloodshed software's Dev-C++ (which uses MinGW as a compiler, optionally included in the Dev-C++ download).
- Bloodshed Home Page
- Direct Download Link for Dev-C++ (note: if you choose the "nomingw" version, you'll have to install MinGW seperately)
Finally, Microsoft offers a free version of their Visual Studio 2005 Express, which includes a graphical IDE and can compile C and C++ source code. To use the command-line tools and debugger, you'll also need the Platform SDK. - Visual Studio 2005 Express Home Page
- Visual Studio 2005 Express Download Page (note: you'll want BOTH Visual C++, and the Platform SDK)
Luckily, Mac OS X and later come with a C compiler built-in. To access it, go to "Applications", "Utilities", "Terminal" to get to a terminal command prompt. Then, you can just use gcc to compile your code; e.g., type in:
gcc -o program program.c
You will need to know how to use the Terminal. Terminal commands are 99% identical to Linux Commands (see below for link to Linux command tutorial)
If you currently have Linux installed on your system, then you probably have a C compiler already installed. To find out, open a Terminal (also called Console) window, and type in:
This should give you details about your gcc compiler. If it says something like "gcc: command not found", then you don't have gcc installed. Installing gcc on linux varies from distribution to distribution, however, on Ubuntu Linux, it's very simple.
Installing gcc on Ubuntu Linux:
Open a Terminal window, and type:
This will make you the root user (like Administrator on Windows), and allow you to install new software. Type in the root password. Next, type in:
apt-get install build-essential
This will trigger the Apt-Get install system, which will automatically download numerous packages and prompt you to confirm whether to install them. After they are installed, try typing 'gcc -v' again, and this time it should work.
Downloading and Running Linux
All distributions of Linux have a free version, and many have only free versions. All you have to do is download it and burn a CD.
I would recommend Ubuntu Linux for this class. Ubuntu is a relatively new distribution (it began in 2005), and is a derivative of Debian Linux (which is one of the oldest distributions around). Ubuntu is actively updated by the Debian project. Ubuntu is designed specifically for beginners and those who don't want to spend much time trying to get their hardware functioning correctly. It also comes with a large suite of software built-in, such as the OpenOffice office suite and many others.
With Ubuntu, you can run Linux from the CD without necessarily installing it. This will give you a fully featured linux distribution without touching your hard drive. You will not, however, be able to save any documents you create as a result.
Also, if you do not have a CD burner readily available, the Ubuntu project uniquely allows you to request CDs by mail, at no charge (not even shipping).
If you decide to install Linux, there are two options you have:
Installing Linux as the only operating system on the machine
This is very easy. Just boot from the CD, and choose Install Linux. When prompted what to do with the hard drive, choose overwrite and install linux.
Installing Linux side by side with Windows
You can install Linux along side Windows, so that when you boot, you will simply be prompted to choose which OS to enter. There are different methods for this, all having certain difficulties (but still very doable).
If you are lucky enough to have a spare hard drive, you can simply install Linux on the spare hard drive, so that both Windows and Linux have their own drives. To do this, just go through the normall install process, and choose to install Linux on the second hard drive.
If you have only one hard drive, then you will need to repartition the drive. There are two methods for this, one which is easier but requires re-installing Windows, and one which is harder but allows you to keep all your existing data.
The easy way is to install Linux normally, and when it asks you where to install it, choose to re-partition your hard drive, and leave most of the space available for windows. I'd recommend reserving about 5 GB for Linux, about 1/2 GB for a SWAP partition, and the rest for Windows. Then install linux normally and later re-install Windows on the larger partition.
My guess is that this will not be desirable for most of you.
To resize your existing Windows partition, you will need a third party software such as Partition Magic (which is commercial software, however I can loan out my own copy freely). With Partition magic, you can resize your existing Windows partition to leave about 5.5 GB of free space on the drive. After Partition Magic completes, you can then boot from the Linux CD, choose to install linux, and create a new Linux partition (of about 5 GB) and a new Linux swap partition (of about 1/2 GB). After Linux is installed, you should have a choice when you boot the computer as to whether to boot from Linux or Windows.
Also note: there are numerous Linux distributions, and I recommend that if you become savvy with Linux, that you try some of the more advanced distros, such as Mandriva, Slackware, Gentoo, CentOS or one of many others...
- Ubuntu Linux Home Page
- Ubuntu Linux Download Page
- Ubuntu CD by Mail request page
- Partition Magic Home Page (note: I can loan out my copy of this)
- Mandriva Linux Home Page
- Slackware Linux Home Page
- Gentoo Linux Home Page
- CentOS Linux Home Page
Unix command reference
There are numerous commands available in Unix. Below are links to references to most of them. I have sorted them by what I consider to be most useful to least useful.
- Unix Command Summary
- The Unix Acronym List: Unix Commands
- Basic UNIX commands
- List of Unix utilities - Wikipedia
- Unix commands reference card
C programming language reference
Finally I have posted various helpful C references. As I go through each lesson, I will try to post a summary of that lesson on this site.
Links to other C references
- The C Library Reference Guide
- C/C++ Reference
- Standard C
- C Programming Reference
- The GNU C Library
- C Programming Reference - eLook
- Microsoft C Language Reference (use only as a last resort)