Skip to main content
Engineering LibreTexts

19: Introduction to Arrays

  • Page ID
    10365
    • 19.1: Array Data Type
      An array is a sequenced collection of elements of the same data type with a single identifier name. As such, the array data type belongs to the "Complex" category or family of data types. Arrays can have multiple axes (more than one axis). Each axis is a dimension. Thus a single dimension array is also known as a list.
    • 19.2: Array Index Operator
      This second usage of the square brackets is as the array notation of dereference or more commonly called the index operator. As an operator it either provides the value held by the member of the array (Rvalue) or changes the value of member (Lvalue). In the above example the member that is two offsets from the front of the array (the value 26) is assigned to variable named my_age.
    • 19.3: Displaying Array Members
      This second usage of the square brackets is as the array notation of dereference or more commonly called the index operator. As an operator it provides the value held by the member of the array. For example, during one of the iterations of the for loop the index (which is an integer data type) will have the value of 3.
    • 19.4: Practice 18 Introduction to Arrays