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,71c743c03ed191fe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-15 09:25:20 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.tpinternet.pl!skynet.be!skynet.be!louie!not-for-mail From: Ludovic Brenta Subject: Re: Beginer problem: variable array size Date: Sun, 15 Sep 2002 18:26:05 +0200 Newsgroups: comp.lang.ada Message-ID: References: User-Agent: Pan/0.11.2 (Unix) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Comment-To: "Nacho" Organization: -= Skynet Usenet Service =- NNTP-Posting-Host: 80.200.198.11 X-Trace: 1032107108 reader1.news.skynet.be 211 80.200.198.11 X-Complaints-To: abuse@skynet.be Xref: archiver1.google.com comp.lang.ada:28985 Date: 2002-09-15T18:26:05+02:00 List-Id: On Sun, 15 Sep 2002 18:16:51 +0200, Nacho wrote: > That does not resolve the problem. I need to change the size of the > array after it has been created. With your solution once array_called_p > has been created it will never change its size. Yes, that's what I thought too. How about this: with Ada.Text_Io, Ada.Unchecked_Deallocation; procedure Vararray is type Var_Array is array(Positive range <>) of Integer; type Var_Array_Access is access Var_Array; Size : Positive; Variable : Var_Array_Access; procedure Free is new Ada.Unchecked_Deallocation(Var_Array, Var_Array_Access); begin Size := 50; Variable := new Var_Array(1..Size); for I in Variable'Range loop Variable(I) := I; Ada.Text_Io.Put_Line("var_array(" & Integer'Image(I) & ") = " & Integer'Image(I)); end loop; Free(Variable); Size := 80; Variable := new Var_Array(1..Size); for I in Variable'Range loop variable(I) := I; Ada.Text_Io.Put_Line("var_array(" & Integer'Image(I) & ") = " & Integer'Image(I)); end loop; Free(Variable); end Vararray; HTH -- Ludovic Brenta.