CS 12 Homework Assignment 5
CS 12 Homepage
This assignment is due on Wednesday, August 13, 2003, at the start of the lecture. Please hand in printed solutions.
1. Explain, in your own words, what a memory leak is and what consequences derive from it.
2. Explain, in your own words, what a dangling pointer is and what consequences derive from it.
3. What is the most important difference between a variable allocated in the stack and a variable allocated in the heap?
4. Explain in your own words what happens when the statement int * p = new int(7); is executed.
5. Explain in your own words what happens when the statement delete p; is executed, where p is the variable defined in the previous question.
6. If a is an array of char's, what happens when the statement delete a; is executed?
© 2003 UC Riverside Department of Computer Science & Engineering. All rights reserved.