Section 9.7
Review Questions

A pointer example

  1. Which of the following C declarations creates a pointer?
               int *m;
               int n;
  1. What is the meaning of the asterisk in the following C code?
               z = *m;
  1. What are pointers, really?
          a.  memory addresses
          
          b.  pieces of data
          
          c.  complete arrays
          
          d.  special machine instructions?
  1. Why is there not much difference in machine language between arrays and pointers?
  1. In C, how does the initial pointer get created and put into a pointer variable? Write the line of code that puts the base address of the source block into pointer p1.
  1. Some computers have machine instructions which can do address calculations while loading the data into the accumulator, thereby circumventing the need for 3 or 4 separate instructions. What is the downside of this?
  1. Why can characters be manipulated by the CSC-1 by merely shuffling integers around between memory and the registers? (HINT: Remember ASCII?)
  1. Write a short chunk of CSC-1 code to get the integer pointed at by p and store it into the A register. Do not change p.
  1. Write a short chunk of CSC-1 code to get the integer pointed at by p, add 1 to it, and store it back into memory at the same location. Do not change p. (harder)