CSC 253 Lecture 8
What regions can hold our data? A. Stack, static, and extern B. Stack, heap, and static C. Stack and heap D. Local and static E. Local, static and extern
Why do we need heap storage? A. To make sure we don’t run out of memory. B. To allow variables to outlast procedure calls & returns. C. To give us a place to allocate arrays D. Both A and C.
Pointers to variables on the stack Declare a non-pointer variable. Declare a pointer variable. Set the pointer to point to the non-pointer.
Pointers to variables on the heap
What happens if we increment a pointer?
Incrementing pointer vs. incrementing value pointed to
Let’s make our printing code into a procedure What parameters would we pass? What type is the first parameter? What type is the second parameter? int int* int & char
Why use handles?