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-Thread: 103376,ca20ac98709f9b4a X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news.glorb.com!feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!feeder3.cambrium.nl!feed.tweaknews.nl!posting.tweaknews.nl!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Array of Strings References: From: Ludovic Brenta Date: Sat, 13 Sep 2008 16:32:54 +0200 Message-ID: <87hc8kjeuh.fsf@ludovic-brenta.org> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:+3GCtoNas2+wR5Fb5G/2ODm11s0= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Tele2 X-Trace: DXC=2_DMj\d`d^1Mii]OaCe>F66`Y6aWje^Y:Um9R:52MG_>LhmSMf93G:0mXCj4l`k_R7i_42CiJEY>2 Xref: g2news1.google.com comp.lang.ada:2014 Date: 2008-09-13T16:32:54+02:00 List-Id: jedivaughn writes: > Hi everyone, > > I'm having trouble making a array of type string. can some one show me > how to do this. I've tried type letters is array (Integer range <>) of > String; but I get error "unconstrained element type in array > declaration". what am I doing wrong? The type String is unconstrained because you don't know the size of the strings at compile time. Therefore you cannot put Strings in an array. You can however create: - an array of fixed-size strings; for this you need a subtype e.g. subtype Constrained_String is String (1 .. 10); type Array_Of_Constrained_Strings is array (Positive range <>) of Constrained_String; - an array of access values to Strings e.g. type String_Access is access String; type Array_Of_String_Accesses is array (Positive range <>) of String_Access; (!this is the most error-prone method!) - an array of Ada.Strings.Unbounded.Unbounded_Strings e.g. type Array_Of_Unbouded_Strings is array (Positive range <>) of Ada.Strings.Unbounded.Unbounded_String; - an array of Ada.Strings.Bounded.Bounded_Strings similar to the above but you also need to specify the maximum size HTH -- Ludovic Brenta.