comp.lang.ada
 help / color / mirror / Atom feed
* arrays..
@ 2002-05-12 23:34 devine
  0 siblings, 0 replies; 7+ messages in thread
From: devine @ 2002-05-12 23:34 UTC (permalink / raw)


Hi.  I have seen many examples of array of integers and floats, are their
any examples of  array of characters and array of words?





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

* RE: arrays..
@ 2002-05-13  0:30 Beard, Frank [Contractor]
  2002-05-13 10:45 ` arrays chris.danx
  0 siblings, 1 reply; 7+ messages in thread
From: Beard, Frank [Contractor] @ 2002-05-13  0:30 UTC (permalink / raw)


Arrays of characters are called strings:

   word : string (1..50);   -- anonymous declaration

or

   type Word_Type is string (1..50);
   word : Word_Type;

Of course, nothing stops you from declaring:

   type Word_Type is array (1..50) of character;
   word : Word_Type;

But, there are advantages to using strings, including
predefined packages for doing various things.

As far as arrays of words, you will have to grow
your own.  You could use something like:

   type Word_Array is array (1..100) of Word_Type;

or, a little more dynamic:

   type Word_Array is array (1..100) of
           Ada.Strings.Unbounded.Unbounded_String;

Plus, a hundred other variations.

Frank

-----Original Message-----
From: devine
To: comp.lang.ada@ada.eu.org
Sent: 5/12/02 7:34 PM
Subject: arrays..

Hi.  I have seen many examples of array of integers and floats, are
their
any examples of  array of characters and array of words?


_______________________________________________
comp.lang.ada mailing list
comp.lang.ada@ada.eu.org
http://ada.eu.org/mailman/listinfo/comp.lang.ada



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

* Re: arrays..
  2002-05-13  0:30 arrays Beard, Frank [Contractor]
@ 2002-05-13 10:45 ` chris.danx
  0 siblings, 0 replies; 7+ messages in thread
From: chris.danx @ 2002-05-13 10:45 UTC (permalink / raw)



"Beard, Frank [Contractor]" <beardf@spawar.navy.mil> wrote in message
news:mailman.1021249922.3094.comp.lang.ada@ada.eu.org...
> Arrays of characters are called strings:
>
>    word : string (1..50);   -- anonymous declaration
>
> or
>
>    type Word_Type is string (1..50);

                   ^^^
this is incorrect (it won't compile).  Should either be

    subtype word_type is string (1..50);

or  type word_type is new string (1..50);


Chris







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

* Arrays
@ 2003-05-29 10:08 Drey
  2003-05-29 12:00 ` Arrays John R. Strohm
  2003-05-29 12:22 ` Arrays David C. Hoos, Sr.
  0 siblings, 2 replies; 7+ messages in thread
From: Drey @ 2003-05-29 10:08 UTC (permalink / raw)


hi !

problem: i need the last place of a 2 dimensional array

well how can i do it ?

A : array (1..2,3..4);
...
A'last = 2 ?
and how do i get 2nd dimension ?

Thanks :)



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

* Re: Arrays
  2003-05-29 10:08 Arrays Drey
@ 2003-05-29 12:00 ` John R. Strohm
  2003-05-29 12:22 ` Arrays David C. Hoos, Sr.
  1 sibling, 0 replies; 7+ messages in thread
From: John R. Strohm @ 2003-05-29 12:00 UTC (permalink / raw)


"Drey" <DreySf@gmx.net> wrote in message
news:e723f896.0305290208.ceb6d95@posting.google.com...
> hi !
>
> problem: i need the last place of a 2 dimensional array
>
> well how can i do it ?
>
> A : array (1..2,3..4);
> ...
> A'last = 2 ?
> and how do i get 2nd dimension ?
>
> Thanks :)

Define "last place".

As I read what you typed, you want a 2x2 array subscripted as follows:

  A(1,3) A(1,4)
  A(2,3) A(2,4)

I.e., two rows, numbered 1 and 2, and two columns, numbered 3 and 4.

Which of these elements is intended to be the "last" element?  And why do
you care about the "last" element?

I'm guessing that you are trying to do some kind of ugly hackery to pass
your Ada matrix to some perverted C code, and you haven't read the stuff
about foreign language interfaces yet.





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

* Re: Arrays
  2003-05-29 10:08 Arrays Drey
  2003-05-29 12:00 ` Arrays John R. Strohm
@ 2003-05-29 12:22 ` David C. Hoos, Sr.
  2003-05-29 20:36   ` Arrays Drey
  1 sibling, 1 reply; 7+ messages in thread
From: David C. Hoos, Sr. @ 2003-05-29 12:22 UTC (permalink / raw)
  To: comp.lang.ada; +Cc: Drey


----- Original Message ----- 
From: "Drey" <DreySf@gmx.net>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: Thursday, May 29, 2003 10:08 AM
Subject: Arrays


> hi !
> 
> problem: i need the last place of a 2 dimensional array

You didn't specifiy of which dimension you need the last place;
there is no "last place of a 2 dimensional array."

This is defined in RM 3.6.2
The last element of the Nth dimension of A is A'Last (N). 
> 
> well how can i do it ?
> 
> A : array (1..2,3..4);
> ...
> A'last = 2 ?
A'Last for a multidemnsional array is the same as A'Last (1).

> and how do i get 2nd dimension ?
In your above example array A'Last (2) = 4

> 
> Thanks :)
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
> 
> 




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

* Re: Arrays
  2003-05-29 12:22 ` Arrays David C. Hoos, Sr.
@ 2003-05-29 20:36   ` Drey
  0 siblings, 0 replies; 7+ messages in thread
From: Drey @ 2003-05-29 20:36 UTC (permalink / raw)


"David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> wrote in message news:<mailman.16.1054210964.386.comp.lang.ada@ada.eu.org>...
> ----- Original Message ----- 
> ...
> This is defined in RM 3.6.2
> ...
> A'Last for a multidemnsional array is the same as A'Last (1).
> ..
> In your above example array A'Last (2) = 4
> 

 Thanks :)

that what i meant :)



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

end of thread, other threads:[~2003-05-29 20:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-29 10:08 Arrays Drey
2003-05-29 12:00 ` Arrays John R. Strohm
2003-05-29 12:22 ` Arrays David C. Hoos, Sr.
2003-05-29 20:36   ` Arrays Drey
  -- strict thread matches above, loose matches on Subject: below --
2002-05-13  0:30 arrays Beard, Frank [Contractor]
2002-05-13 10:45 ` arrays chris.danx
2002-05-12 23:34 arrays devine

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