Windows users should set up WSL.
- basic commandline fu (navigation, file / folder manipulation, ...)
- your favourite text editor
- GCC / Clang installed
See my C programming repo for code examples.
-
Lecture -2: mathematics background
- numbers and their representation (base 2, 8, 10, 16)
- bits and bytes, and their limitations
- ASCII
- boolean logic
- bitwise operations
- set theory
- functions
- types
-
Lecture -1: computer architecture
- CPU / memory
- op-codes
- locality
-
Lecture 0: empty program
- syntax
void
- compiler warnings / errors
-
Lecture 1: Hello World
- use of standard library
- man-pages
-
Lecture 2: variables
- types
- assignment
sizeof
- different ways to write a number
- boolean in C
- scope
-
Lecture 3: Simple I/O
puts
/printf
getchar
/scanf
-
Lecture 4: arithmetic
- precedence
- integer arithmetic
- floating point arithmetic
- bitwise operations
- boolean operations
- short circuit evaluation
- comparison operations
- compound assignment
- increment / decrement operators
- sequence points
-
Lecture 5: Branching
if
/else
-
Lecture 6: Loops
while
/do while
for
break
/continue
goto
-
Exercise: Fizz-Buzz
- Output all numbers from 1 to 100 (one per line).
- Any number divisible by 3 is replaced by fizz.
- Any number divisible by 5 is replaced by buzz.
- Any number divisible by 3 and 5 is replaced by fizzbuzz.
-
Exercise: Zapfen
- Read in integer from user.
- Continuously multiply with numbers from 2 to 12 (inclusive).
- Then continuously divide by numbers from 2 to 12 (inclusive).
- Try this for large user inputs.
- Try this with unsigned.
- Try this with float.
-
Exercise: Mastermind
- See
rand(3)
. - Include
time.h
and callsrand(time(NULL));
once before usingrand
to seed the random number generator (RNG). - Randomly pick 4 integers between 1 and 6 (inclusive).
- User has to guess the combination by entering a sequence of numbers separated by spaces.
- User can guess 10 times.
- Game ends when user guessed correctly or all guesses have been exhausted.
- Program will output hints on wrong guesses.
- See
-
Exercise: Prime Numbers
- Output all prime numbers from 1 to 100.
-
Lecture 7: Functions
- normal
- recursion
-
Exercise: Better Prime Numbers
- Rewrite the prime numbers exercise to use a function
is_prime
.
- Rewrite the prime numbers exercise to use a function
-
Lecture 8: Pointers
-
Lecture 9: Arrays
- 1D
- more dimensions
- strings
- pointer-decay
-
Exercise: Pascal's triangle
- Calculate the first 10 rows of Pascal's triangle and print them.
- Use an array.
-
Exercise: Levenshtein distance
- Read in two strings from the user.
- Output the corresponding Levenshtein distance.
- Put the Levenshtein calculation in a dedicated function.
-
Lecture 10: Enums
-
Lecture 11:
struct
union
- recursive structures
-
Exercise: Conway's Game of Life
- See
fopen(3)
andfwrite(3)
- See PBM file format.
- Use hard-coded field size and simulation step count.
- Initialise the field with random population.
- Simulate and store each frame as file (eg
frame_072.pbm
). - Use
convert(1)
(part of Imagemagick) to create an animated GIF.- Do not invoke
convert
from your program, use a Bash script.
- Do not invoke
- See
-
Exercise: Mandelbrot
- Implement a typical visualisation of the Mandelbrot set.
- You can either use the PGM format or print it as ASCII art.
...