4.1.3

Arrays

Test yourself

Arrays

Arrays are really useful when you have access to large amounts of related data, but you don't want to store in multiple variables.

Illustrative background for ArraysIllustrative background for Arrays ?? "content

Arrays

  • An array is a data structure that stores a fixed number of values under a single identifier.
  • The values must be of the same type.
Illustrative background for Array elementsIllustrative background for Array elements ?? "content

Array elements

  • Each piece of data inside an array is called an element.
  • Each element has an index, which is its position within the array.
  • We start counting the indices from 0.
Illustrative background for Arrays in pseudocodeIllustrative background for Arrays in pseudocode ?? "content

Arrays in pseudocode

  • An array of ten items can be created using the following syntax:
    • array name_of_array[10]
  • Values can be assigned as follows:
    • name_of_array[0] = "Hello"
  • Values can be accessed as follows:
    • print(name_of_array[0])

Jump to other topics

1Components of a Computer

2Software & Software Development

3Exchanging Data

4Data Types, Data Structures & Algorithms

5Legal, Moral, Cultural & Ethical Issues

6Elements of Computational Thinking

6.1Thinking Abstractly

6.2Thinking Ahead

6.3Thinking Procedurally

6.4Thinking Logically

6.5Thinking Concurrently

7Problem Solving & Programming

8Algorithms

Unlock your full potential with Seneca Premium

  • Unlimited access to 10,000+ open-ended exam questions

  • Mini-mock exams based on your study history

  • Unlock 800+ premium courses & e-books

Get started with Seneca Premium