50 likes | 172 Views
Introducing Arrays. Defintion. An Array is a chain of elements of the same type. Examples: Days of the week Student marks What other examples can you come up with?. 0. Janie. Bobby. 1. Sally. 2. Joey. 3. Mary. 4. RowA. Example of a 1D Array. Mary is located in RowA[4].
E N D
Defintion • An Array is a chain of elements of the same type. • Examples: • Days of the week • Student marks • What other examples can you come up with?
0 Janie Bobby 1 Sally 2 Joey 3 Mary 4 RowA Example of a 1D Array Mary is located in RowA[4]
Array examples • Var • myArray : Array[1..20] of Integer; • Questions • What is the name of this array? • How many elements are there? • What is the data type? myArray 20 Integer
Two Dimensional Array: • 2D array stores variables in two dimensions. • A chess board is an example of a 2D array • A matrix is another name for this