Revision Tutorial

Hello! If you're interested in doing some 1917 revision before the exam, I'll be holding a revision tutorial at 1pm on Tuesday, 1st November. For now I'll set the location to be Kora lab, end of the hallway on Level 3 of Mechanical Engineering (J17). Depending on how many people show up we may want to change rooms, and I'll update this page if that's the case.

Please bring along questions or topics you're unsure about, because otherwise we'll spend all the time trying to figure out what we should do :)

Revision Tutorial Update!

Sorry for the last minute change; I've moved the room to Flute because there's a few people in Kora and I'd prefer not to disturb people if possible. Same floor, same time, just in Flute (near the lifts) instead.

Revision Youtube Video Note: There may be content in here which is no longer relevant!

Tutorial 6

  1. len_str.c
  2. reverse_string.c
  3. substr.c

Tutorial 7

  1. readArray.c
  2. Whoever calls the function needs to later call free() on the returned pointer. Failing to do so causes a "memory leak", where the operating system isn't made aware that we're no longer using a piece of memory, and never allocates it to anybody else.
  3. In this example, createArray() returns a pointer to a local array. However, when the function ends, the memory associated with it is free to be used by other functions. This means that the values of the array may change when we access it later! Instead, we should use malloc() to put the array in the heap, and manage the memory ourself.
  4. dist.c
  5. students.c

Tutorial 8

To compile the program, use gcc -Wall -Werror -O -o testPoint testPoint.c Point.c

Tutorial 9

Tutorial 10

Tutorial 11

Tutorial 12