Hour 9. Storing Information with Arrays

No one benefited more from the development of the computer than Santa Claus. For centuries, humankind has put an immense burden on him to gather and process information. Old St. Nick has to keep track of the following things:

  • Naughty children
  • Nice children
  • Gift requests
  • Homes with impassable chimneys
  • Women who want more from Santa than Mrs. Claus is willing to let him give
  • Countries that shoot unidentified aircraft first and ask questions later

Computers were a great boon at the North Pole. They are ideal for the storage, categorization, and study of information. The most basic way that information is stored in a computer program is by putting it into a variable. However, this method is limited to relatively simple usage. If Santa had to give each naughty child his or her own variable name, he would be working on the program for the next 12 holiday seasons at least, to say nothing of the effect on his jolly disposition. The list of naughty children is an example of a collection of similar information. Each child's name is a string of text or some kind of Santa Information System ID number. To keep track of a list of this kind, you can use arrays. Arrays are groups of related variables that share the same type. You can have arrays of any type of information that can be stored as a variable. Arrays can be used to keep track of more sophisticated types of information than a single variable, but they are almost as easy to create and manipulate as variables are. The following topics will be covered during this hour:

  • Creating an array
  • What a dimension of an array is
  • Giving a value to an array element
  • Changing the information in an array
  • Making multidimensional arrays
  • Sorting an array
      
Comments