Comp 121

Chapter 8 Study Guide

Chapter 8

 

What are the three major items associated with every variable?

 

What determines the number of memory bytes set-aside for the variable?

 

If num is a variable, what is the difference between num and &num?

 

What is a pointer?

 

What does the indirection operator (*) mean? For example, what does *d mean?

 

How do you declare a pointer that is the address of a float?

 

What is the difference between a reference and a pointer?

 

If grade is an array that contains integers, how does the compiler calculate &grade[3]?

 

How are offsets used with pointers? For example, what does *(gPtr + 2) reference? What is the difference between *(gPtr + 2) and *gPtr + 2?

 

What is the difference between an array name and a true pointer?

 

What is dynamic allocation of memory and why is it useful?

 

What does the new operator do? What does the delete operator do?

 

What happens when you add or subtract numbers from pointers? Can pointers be compared?

 

How do you pass the address of the variable firstnum to the function swap? Is this a pass by reference or a pass by value?

 

How do you perform a swap using pointers?

 

When an array is passed to a function, what is actually passed?

 

For two-dimensional array nums, what is the pointer notation for nums[0][2] and nums[1][0]?