Arrays

An array is a variable that allows you to use a single variable name to be associated with all instances of that variable.

  • holds a fixed number of values of a single type
  • Length of an array is established when the array is created
  • After creation, its length is fixed

Array processing

  • Arrays are one of the most powerful programming tools available
  • Provide programmer with a way of organizing and collecting of homogeneous data items
  • Allow the data elements to be contained within a single variable
  • Elements (items) in an array are distinguished from each other via an index or subscript
  • Elements in an array can be processed with either a DO loop or DOWHILE loop
  • An array is a data structure that is made up of a number of variables of all the same data type.

Typical operations on arrays

  • Initialize values of the array elements
  • Process each elements of the array
  • Search the array for a particular element
  • Write the contents of an array to a report

Common algorithms that manipulate arrays

  • Find the sum of the elements of an array
  • Find the mean (average) of the elements of an array
  • Find the largest of the elements of an array
  • Find the smallest of the elements of an array
  • Find the range of the elements of an array

Initializing the elements of an array

  • Load constant values into an array
  • Laad initial values into an array from an input file