| Contact PSVM (Q & A) | Notes Below Audio | [toc] [prev] Slide 6 of 12 [next] |
|
|
| 1, 2, 3, 4, 5, [6 (top)], 7, 8, 9, 10, 11, 12, [Lab] |
|
Notes for Slide 06 This shows an example, using the name i instead of the name counter in the for-statement, of a scores array with 10 values. The first time through the loop scores[i] is referencing the first element in the array which is shown to be 85. The other values in the scores array are not shown except the final value which is referenced with scores[i] when i is set to 9. The final value, 97, can also be retrieved by using scores[9]. But, recall that we are using arrays and for-loops because we want to be able to handle problems that could contain 100 scores. So, it is more likely that you would use scores[i] than scores[9] to obtain the final value of 97 in your program. 1, 2, 3, 4, 5, [6 (top)], 7, 8, 9, 10, 11, 12, [Lab] |