In lecture today, the following topics were covered:
- when one can and can’t use slices (subarrays) of a multi-dimensional array
- the pointer data type
- how pointers relate to addressing and the addressing operator (&)
- the notion of dynamic memory allocation
- how memory from the stack is different from memory from the heap
- the operators used for dynamic memory allocation (new, delete)
- how memory leaks can be created
The following programs were demonstrated in class:
- pointerExamples.cpp (pointers and addressing)
- dma.cpp (pointers and dynamic memory allocation)
- memoryLeak.cpp (rapid allocation of memory without the corresponding deletion; eventually crashes after exhausting available RAM)