22D. Chunks Are Not Automatically Copied

Consider the following C++ code.

  int A[10];
  int* B = A;
  A[1] = 5;
  B[1] = 7;
What is the value of A[1] at the end? It must be 7. That is clear from the following pointer diagram.

An array is a pointer, and statement B = A only copies the pointer, not the chunk to which the pointer points.