Department of Computer Science and Technology

Course pages 2019–20

Programming in C and C++

Assessed Exercise

The assessed exercise deadline (from form and conduct) is 12 Noon 20th January 2020 with follow-up viva on Thursday or Friday of the same week.

Your DoS has access to a table showing whether your submission has been received.

Ticking viva sessions will start at 1:45 pm on 23rd and 24th January (stopping at 3:00pm sharp on 23rd) and suggested arrival times are on this SLOT STARTS LINK. Do not worry if you cannot make your suggested time; come at another time. As long as not too many people deviate then the ticking queue should stay short. If you have asked for an extension, you are still shown on the timetable but you are not expected to attend.

These vivas will be very quick and it is expected nearly everybody will be awarded their tick there-and-then. The tick will be awarded even in the presence of minor errors provided it is obvious to the ticker that you fully understand the nature of your error and would be able to fix it without problem. If there are deeper questions of accuracy or authenticity, you will be invited for a futher viva the following week with two Examiners present.

You do not need to bring anything, but if you have your your submission open in an editor on your laptop/tablet as you sit down for viva, things might go slightly faster.

Vivas will take place in the Intel lab. Please respect the privacy of the candidate being viva'd by not approaching the ticking desk until beckoned.

Worksheet CC++exercise1920.pdf.

Starter pack starter_pack.tgz.

Programming in C (DJ Greaves)

Lecture Notes

Class Materials and Worksheets

There are 8 programming tasks in C and one Assessed Exercise. The programming tasks are informal and not ticked. Details of the Assessed Exercise will be announced in Week 3 or 4 of term.

Task 1

There is no task 1, except to gain access to a C compiler and repeat one of the demos from lecture 1.

Session 2

Erratum: There is some variation of names, leading to too many function prototypes listed in the lab notes. You can use any variation of the name. Ditto Task 3.

Session 3

For Task 3, you may find that mergesort is already defined in the standard header file on your computer. If you get a clash, then perhaps rename your sort routine to another name.

Session 4

Note: The video and slides for Lecture 4 mention last year's Assessed Exercise (tick). This is not quite the same as this year's tick.

Erattum: The lab4.tar.gz folder contains/contained a file called list.c that should be called tree.c. Please rename your copy if necessary. I will update the download.

Session 5

Session 6

Session 7 (String Matching)

  • Lecture 7 Video.
  • Erratum: The arguments to set_left where we are making a loop should be n1 instead of node1, etc..
  • Lecture 7 Slides
  • Task 7 Lab notes (PDF)
  • Task 7 Lab package (.tar.gz format)
  • Of interest?: The C-- backend language is a C-like programming language whose creators include Dr S Peyton-Jones of the Computer Laboratory. It is intended to be generated mainly by compilers for very high-level languages rather than written by human programmers. Unlike many other intermediate languages, its representation is plain ASCII text, not bytecode or another binary format.

Session 8 (Caches)

  • Lecture 8 Video.
  • Lecture 8 Slides
  • Task 8 Lab notes (PDF)
  • Task 8 Lab package (.tar.gz format)
  • Of interest?: In 1999, Dr David J Greaves (lecturer of this course), wrote a program that converted Verilog to C++. Hundreds of chip companies used this program to generate fast software models of ICs that did not yet exist. When a whole chip was converted, the output was sometimes a C++ program of millions of lines in length. It consisted mainly of one basic block (per clock domain) containing straight-line code. Such blocks were called once per modelled clock cycle and as a result, there was no temporal locality in the instruction caches. This degraded performance, but the tool was still useful. GNU gcc handled the generated code with no problem. Special adaption was required to overcome Visual C's limitations such as parenthesis nesting of greater than 255 levels or structs with thousands of fields.

Session 9

Programming in C++ (A Mycroft)

Lectures 10 -- 12: C++

Installing a Virtual Machine Image

If you do not have gcc or llvm installed on your laptop, then:

  1. Download a

    virtual machine image for Ubuntu Linux with gcc and llvm installed.

  2. Go to the the VirtualBox website to find out how to install the VirtualBox software on your machine.


Last year’s course materials are still available.

Instructions for lecturers: how to edit this page