Module EE1.pca

Introduction to Programming
and Computer Architecture

Lecturer Prof R Bowden

Level 1

This module aims to familiarise you with the fundamentals of computer architecture and the relationship between the underlying computer and the C language. It will develop these concepts to show how C can be used as a true high level language, demonstrating both procedural and data abstraction.

Assessment will be by a multiple choice examination at the end of the semester.

The programming laboratory is closely associated with this module but will be assessed separately.

Compilers

Any of the Unix machines you log into should have a compiler by default, normally gcc but some flavours of unix may have others.

After writting your program using a text editor (emacs or vi) you simply type gcc <prog_name.c> to compile this into an executable. If youve made a mistake then the compiler will promt you. If all went well it will produce a default executale called a.out which you can run from the command prompt. You can get more details from the programming laboratory.

Previous lecturers of this course have kindly compiled a list of other C compilers for DOS, which you can download and install on your own PC. I haven't tried them myself though so good luck. There is also a version of  gcc for DOS. Please read the installation instructions before you start, to see whether you think you can do it, as it's rather involved. Again, I haven't attempted to install it myself.

An online test

There is also an online test available. It consists of 20 multiple choice questions. A Perl CGI script will mark the test automatically and return a mark to you. This should give you some idea of how you'll do in the end of semester exam! The test is completely anonymous, and you can practise it as many times as you like. 

Unfortunately the automarking script is broken (as many of you know) as a quick fix click here for the answers to the test.

Online Resources

The best way to learn a programming language is to write your own programs. But when you get stuck, it's often useful to look at working examples. The following links give direct access to hundreds of simple programs, each illustrating an aspect of the C language.

Besides studying these programs in your browser, you can copy and paste the code into your own files, then compile and run them. Change the code and see the effect of your modifications -- it's an excellent way to learn.

You'll also find reference material on the course and on the C language.

The Unix operating system was written in C, and you can get help from the online manual.

For example, on the Unix command line enter

man getchar

to find out about the getchar() function, or

man stdio

for details of the <stdio.h> header file.


David C. Hamill
D.Hamill@surrey.ac.uk

Revised 17/9/01 by Richard Bowden