TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
X-To: Alexandre Crozat <[log in to unmask]>
Date: Tue, 6 May 1997 15:01:21 -0400
Reply-To: Scott Edgerton {81813} <[log in to unmask]>
From: Scott Edgerton {81813} <[log in to unmask]>
In-Reply-To: <[log in to unmask]>
Content-Type: TEXT/PLAIN; charset=US-ASCII
MIME-Version: 1.0
Parts/Attachments: TEXT/PLAIN (35 lines)
On Tue, 6 May 1997, Alexandre Crozat wrote:

> Learning Ada by onesself in only two months is hard, but I'm getting at it...
> Could someone help me with this one:
>
> Is it possible to initialize a multi-dimensionnal array during its definition?
> For single-dimensional arrays, the answer is yes:
>    Init : array (0 .. 3) of Integer := (0 => 1, others => 0)
> but what about a 2d array which I would like to fill with zeros?
>
> Thanks for your help.
>
> Alex
> _______________________________________ ...
> Alexandre Crozat
> 2 adresses -|> 2 reasons to reply!  :-)
> [log in to unmask]
> [log in to unmask]

This is how you can initialize a two dimensional array using Others

subtype Count_Type is integer range 0 .. 20;

type Td_Array_Type is array
        (Integer range 1..5, Integer range 1..5) of Count_Type;

Td_Array : Td_Array_Type := (Others => (0, Others => 0));



Disclaimer: The views here are mine, not my employers..
_______________________________________________________________________
Scott G. Edgerton                       Tel (508)858-5085
TMD Battle Management Dept              Fax (508)858-1502

ATOM RSS1 RSS2