comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: how  to declare an array of pointers
Date: Sun, 02 Nov 2003 00:04:46 GMT
Date: 2003-11-02T00:04:46+00:00	[thread overview]
Message-ID: <ySXob.79714$Fm2.61928@attbi_s04> (raw)
In-Reply-To: KmXob.914$qh2.56@newsread4.news.pas.earthlink.net

>>    type Array_Hash_type is array (10..HASH_SIZE) of p_node;
>i dont understand how do i access an elemnt?
>
>Array_Hash_type(index).something

If you have a particular array, say
     Main_Hash : Array_Hash_type;
then
     Main_Hash(i).all   is whatever whatever that particular p_node
points to.  In common cases you can skip the ".all", eg, if

   type Data is record
     Is_First_Name : Boolean;
     Name : String(1 .. 5);
   end record;

   type P_Node is access Data;

then

  Main_Hash(i).Is_First_Name is the boolean in the Data record at p_node, and
  Main_Hash(i).Name(1)  is the first character in the string at p_node,
and so forth.

>thanks now i have to change all my program
  Surely you didn't "code first, ask questions later"! ;)

>where can i find example on the net?
  In addition to the ones noted, you might do a search at
www.adaic.com/site/wide-search.html
In particular, look for things in the online Style and Quality guide.
  Also as noted, there are often better ways than using pointers to
accomplish things in Ada.



      reply	other threads:[~2003-11-02  0:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-01 16:18 how to declare an array of pointers lolo27
2003-11-01 18:10 ` tmoran
2003-11-01 22:44   ` lolo27
2003-11-01 23:30     ` Jeffrey Carter
2003-11-02  0:04       ` tmoran [this message]
replies disabled

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