comp.lang.ada
 help / color / mirror / Atom feed
* Re : Run time sizing of arrays - HELP
@ 1995-02-07 11:20 Marcel Hawtin
  1995-02-08 15:51 ` Garlington KE
  0 siblings, 1 reply; 2+ messages in thread
From: Marcel Hawtin @ 1995-02-07 11:20 UTC (permalink / raw)



I'm new to Ada, and was wondering if it is possible for the size of arrays to be
determined at run time.

For example, many years ago it was possible to say in BASIC something like :

10 INPUT A
20 INPUT B
20 DIM(A,B)

Any help greatly appreciated.

Thanks Marcel



e-mail : hawtinml@aston.ac.uk





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Re : Run time sizing of arrays - HELP
  1995-02-07 11:20 Re : Run time sizing of arrays - HELP Marcel Hawtin
@ 1995-02-08 15:51 ` Garlington KE
  0 siblings, 0 replies; 2+ messages in thread
From: Garlington KE @ 1995-02-08 15:51 UTC (permalink / raw)


Marcel Hawtin (hawtinml@aston.ac.uk) wrote:

: I'm new to Ada, and was wondering if it is possible for the size of arrays to be
: determined at run time.

: For example, many years ago it was possible to say in BASIC something like :

: 10 INPUT A
: 20 INPUT B
: 20 DIM(A,B)

The equivalent in Ada would go something like:

  A, B : Positive;
  ..
  Pos_IO.Get(A);
  Pos_IO.Get(B);

  declare
     type Some_Dynamic_Array_Type is array (1 .. A, 1 .. B) of Some_Object;
     C : Some_Dynamic_Array_Type;
  begin
  ..

  Notice I said "Something" like, since (1) I don't have an Ada compiler on
  this machine and (2) there's several other ways (all better, I'm sure) for
  creating C and (3) it's been a long time since I wrote any BASIC.  

--------------------------------------------------------------------
Ken Garlington                  GarlingtonKE@lfwc.lockheed.com
F-22 Computer Resources         Lockheed Fort Worth Co.

If LFWC or the F-22 program has any opinions, they aren't telling me.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-02-08 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-02-07 11:20 Re : Run time sizing of arrays - HELP Marcel Hawtin
1995-02-08 15:51 ` Garlington KE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox