Day 17
- Final Exam: Monday, June 6, 7-10pm, building 10, room 223
- Let me know ASAP (today!) if you have a conflict
- Read Chapter 14 sections 1 and 2
- Lab Quiz 3: today during lab
- Lab 8 is due today at end of lab - handin only - no in-person demo required
- Complete Lab 8 Survey
- Lab 9 will be an in-class final exam review on Thursday
- Project 5 is due Thursday night
- Thursday will be review for the final exam; lab quiz 3 retake if necessary
- Lecture Topics
- dynamic memory allocation
- All of our programs so far have required us to know the maximum size/
number of values when we compile, not at run-time
- We can use calloc and malloc to allocate memory at run-time (not compile-time)
- Just don't forget to free the memory when we are done
- When pointers go out of scope, but we have not freed the memory they point to,
we have a memory leak
- dynamic data is allocated on the heap, not the run-time stack
- Example: pointers.c
- malloc - allocate a single memory block of any built-in or user-defined type
- calloc - allocate a contiguous block of memory of any built-in or user-defined type
- free - release memory
- Example: dynamic.c