9.2.3. Arrays-WE2-P3ΒΆ

Subgoals for Evaluating Arrays

  1. Set up array from 0 to size-1

  2. Evaluate data type of statements against array

  3. Trace statements, updating slots as you go

    1. Remember assignment subgoals


Arrays-WE2-P3

Assume the following given declarations:

int [] gamma;

Give the contents of alpha after the execution of these statements.

gamma = new int[6];
gamma[0] = 50;
for (int i = 1; i < 6; i++)
    gamma[i] = gamma[i-1] - 5;
You have attempted of activities on this page