Arrays Flashcards
(6 cards)
1
Q
Creating and Declaring a 1D Array
A
DECLARE Scores: ARRAY [0 : 4] OF INTEGER
2
Q
Creating and Declaring a 2D Array
A
DECLARE NamesAndNumbers : ARRAY[1:3, 1:2] OF STRING
1:3 = 3 rows → one for each person
1:2 = 2 columns → one for name, one for number
3
Q
Assignment 2D Array
A
Players[3,1] ← “Holly”
4
Q
Assignment 1D Array
A
Colours [4] ← “Red”
5
Q
Iterating through a 2D Array
A
FOR Row ← 1 TO 30
FOR Column ← 1 TO 5
StudentScores[Row, Column] ← 0
NEXT Column
NEXT Row
6
Q
Iterating through a 1D Array
A
FOR Index ← 1 TO 30
StudentNames[Index] ← “”
NEXT Index