From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9c98277c71c4cdcc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-11 10:37:51 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Unconstrained arrays Date: 11 Dec 2001 13:22:50 -0500 Organization: NASA Goddard Space Flight Center Message-ID: References: <3C163FBE.9CB75916@rz.uni-karlsruhe.de> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1008095162 2410 128.183.220.71 (11 Dec 2001 18:26:02 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 11 Dec 2001 18:26:02 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: archiver1.google.com comp.lang.ada:17778 Date: 2001-12-11T18:26:02+00:00 List-Id: Michael Unverzagt writes: > Hi! > > We have to write a programm that uses an unconstrained array of > ustrings, where the size of the array should be determined by user > input... > > How does this work? Someone told me, I have to use subtypes but... > Does anyone know a simple example where I can learn how I can define the > size of an array at runtime by user input? Warning, this code has not been compiled (it's homework, so that's your job :). procedure Homework is Array_Length : Integer; type Ustring_Array is array (Integer range <>) of Ustring; begin -- Use Text_IO or something to set Array_Length here! declare My_Array : Ustring_Array (1 .. Array_Length); begin -- do stuff with My_Array end; end Homework; The basic idea is that an array can be declared in an inner block, and the length of the array can be set by a variable. -- -- Stephe