Exercise 17: Heap and Stack Memory Allocation