This module will cover the C/C++ family of programming languages. It is a new module for second-year undergraduates and will run in Semester 2 of 2013/14 for the first time.
Aims: To introduce the C family of programming language, including issues arising from the various extensions of C that have been developed. The module assumes some familiarity with programming in Java, and it will emphasise the differences between C-style languages and Java, such as garbage collection vs memory management and pointers.
There are many special-purpose programming languages that are extensions of C, for example CUDA, which is covered in our Parallel Programming module.
You can join the Facebook group for this module here.
- Draft lecture notes (introduction)
- Evaluating expressions using a stack. This example introduces C pointers and pointer arithmetic.
-
Some C code for representing and
evaluating expressions like 1+2+3+4 in C. This demonstrates struct,
union, enum and switch.
Exercise: compare how you would write this in CAML or Haskell using pattern matching.
Exercise: extend the code to handle Times (the product of two expressions). - Some C code demonstrating how to write objects and classes in C. (Yes, plain C, not C++.) We build everything by hand, which is laborious but insightful.
-
For
comparsion, the corresponding code in
C++ using pure virtual member functions.
Exercise: Compare the C++ code to how you would write it in Java.
Exercise: extend the code to handle Times (the product of two expressions).
The assessment for this module is our standard mix of 80% exam and 20% continuous assessment. The continuous assessment will consist of a class test in one of the lecture slots and answering and creating quesions on Peerwise.