C track: assignment 1


Goals

In this assignment you will learn the basics of compiling programs and the most fundamental aspects of the C language.


Prerequisites


Getting set up on the CS cluster

DO NOT SKIP THIS SECTION!

Many of you will want to develop and run your programs on your own computer, and you are welcome to do so, but the official environment for developing your programs is on the CS cluster. This consists of (a) the computers in Annenberg 104 which run Linux, and (b) any remote login machines available for the cluster. [Currently, there are no remote login machines available on the cluster, but we're working on it.] They all run the same software. You need to do a few small things to get set up to use an up-to-date programming environment on the CS cluster.

The first rule is as follows:

Do not, under any circumstances, develop or run your programs on the CS cluster machine called login.cs.caltech.edu or login.cms.caltech.edu! This computer is not intended to be used for program development at all.

Instead, if you want to develop and test your code remotely, use a remote login machine, if there is one. It will work just like all the other CS cluster computers in the lab.

The software for the CS 11 C track lives in the directory /cs/courses/cs11/install. In order to make this software available to you, you need to do these simple steps:

  1. Log in to a CS cluster computer.

  2. Execute the following line in a terminal (where % represents the terminal prompt):

    % cp /cs/courses/cs11/setup/bashrc-cs11 ~/.bashrc-cs11
    
  3. If you do not have a file in your home directory called .bashrc (use ls -a to check for files beginning with a dot, which are normally hidden), execute the following line in the terminal:

    % cp ~setup/general.bashrc ~/.bashrc
    
  4. At the end of your .bashrc file, add the following line:

    source ~/.bashrc-cs11
    

Now log out and log back in again. You're all set!


Language concepts covered this week

Suggested Reading

Programs to write

To hand in

The hello1.c, hello2.c, and hello3.c programs. Before you hand them in, make sure that you run the style checking program on all of them to catch obvious style mistakes. See the style guide for more information on this.