7.2.1. Test Yourself

Time: 00:03:52 | Download: Large, Large (CC), Small | Streaming, Streaming (CC) | Slides (PDF)
An array with five rows and three columns. An array with five rows and three columns. The element in the fourth row and the second column is colored blue.
(a)(b,c)
Two-dimensional array syntax.
  1. Define an array of ints named scores that matches the array illustrated in Figure 4(a).
  2. If the array illustrated in Figure 4(b,c) is named scores, write an expression that accesses the shaded element.
  3. If the array illustrated in Figure 4(b,c) is named scores, write a statement that stores 50 in the shaded element but does not change the values stored in other array elements.
Answers

We'll revisit the question of index order later in this chapter after the notation needed to understand the examples is introduced.