Previous topic | Next topic | Ada Home Page | Index

Multi-dimensional Arrays

Often we have information in tabular form

Use a multi-dimensional array to represent such information

You can have as many dimensions as wanted

    -- type declaration for higher dimensional arrays
    type CUBE6 is array (1..6, 1..6, 1..6) of CHARACTER;

    -- variable declaration for higher dimensional arrays
    tictactoe_3d : CUBE6;

    -- reference to element in multi-dimensional array
    PUT(tictactoe_3d(2,3,4));

Ada does not limit the number of dimensions. In practice, though, the limit is 3 or 4 dimensions

By far the most common multi-dimensional arrays are two dimensional arrays.


Previous topic | Next topic | Ada Home Page | Index
c-lokan@adfa.oz.au / 27 Feb 96