home search a-z help
University of Cambridge Computer Laboratory
C and C++
Computer Laboratory > Course material 2006-07 > C and C++

C and C++

Principal lecturer: Dr Alastair Beresford
Taken by: Part IB, Part II (General), Diploma

Past exam questions

Programming Exercise in C / C++

You will need to download the following:


You can download the slides for the lecture course:


The 2007 printed notes contain (at the very least!) the following errors. These errors have been corrected in the on-line version of the notes shown above. If you find any further errors, please email the principal lecturer.

Lecture No.Slide No.ErrataCorrige
113False inclusion of operator "~=" in assignment; missing "!" in logicRemove operator "~=" from assignment and add "!" on to the list of logical operators
32A pointer does necessarilyA pointer does not necessarily
36char *pi=&i[5]int *pi=&i[5];
322union u { int i; float f; char c;}union u { int i; float f; char c;};
43Missing "return 0;" at the end of the main functionadd "return 0;" immediately above the closing bracket for the main function
45return n ? 1 : n*fact(n-1)return n ? n*fact(n-1) : 1;
75"try {" should ideally appear on a new lineplace "try {" on a new line