Lecture 3b
Lecture 3b
TECHNIQUES
Lecture 1c
Lecture Outline
■ Arrays
– Accessing an Array
– Types of Arrays
Arrays
■ An array is a collection of similar type of objects or
elements stored in a contiguous memory location.
– Arrays are a collection of variables of the same type
and referenced by the same name.
■ They can also be referred to as a list of related values.
■ The individual elements or objects of an array have the
same data type but have a different position in memory.
Example:
Declare Age[6] as Integer
Age [ ] = {5, 10, 15, 20, 25, 30}
Syntax for Declaring and Creating Arrays
■ One dimensional array:
datatype arrayName [size declarator]
■ Multi-dimensional array:
datatype arrayName [size declarator] [size declarator]