Arrays: Declaring, Attributes, Looping, Aggregates, Iterators

Our First Array - Java Equivalent

Improvment: Bounds Can Start Anywhere

Since we have Array Bounds, it helps to have Attributes

Aggregate Assignment

Aggregate Assignment in Java

Array Iterator

New Array Types and Arrays as Parameters

New Array Types

Array Types have Attributes, too

Why New Array Types

Formal Parameters cannot have an Anonymous Type

Formal Parameters must have a Named Type

Array Types Improve Type Checking

Array Operations

Warning: Semantics Array Operations

Arrays are Fixed Length

Arrays are Fixed Length

Memory Allocation

Strings are Arrays

Strings are Arrays

What About Put_line??

More Information on Strings

Unconstrained Array Types

Constrained and Unconstrained

Type String is Unconstrained

Using Unconstrained Types: Size Required

Unconstrained Array Types for Formal Parameters

Unconstrained Array Types for Formal Parameters

Subtypes of Unconstrained Array Types

Where are Constrained and Unconstrained Array Types Allowed

Unconstrained Array Types and Declare Blocks

Array Operations: Concatenate, Slice, Comparison

Array Operations



Not Just Strings

Slices: Parameter Passing, Dynamic Bounds, and Assignment

  • We can gain flexibility by passing a slice to a parameter that's an unconstrained array

  • Comparison

    Array Operations: Type Checking

    Array Operation: Assignment

    Array Assignment: Type Checking

    Java Array Operations

    Array Assignment and Equality Tests

    Reference and Value Semantics

    Arrays: Enumerated Types for Indices

    Enumerated Types

    Enumerated Types for Array Indices

    Arrays Components Must Have Known Size

    Array Components Must Have Known Size


    Subtypes for Indices and New Numeric Types and Subtypes

    Subtype Definition

    Subtype as Array Index

    Subtypes for Count and Array Index

    Type Checking New Integer Types

    Types and Subtypes for Count and Array Index

    Subtypes Attributes

    Subtypes: Type Checking

    Arrays of Arrays and Multi-Dimensional Arrays

    Arrays of Arrays

    Ada has 2D Arrays

    Arrays of any Dimension