comp.lang.ada
 help / color / mirror / Atom feed
From: "kaak" <the_kaak@hotmail.com>
Subject: Re: Linked List in ada
Date: Wed, 19 Jun 2002 05:53:06 GMT
Date: 2002-06-19T05:53:06+00:00	[thread overview]
Message-ID: <6%UP8.31213$9b.3946299@typhoon.austin.rr.com> (raw)
In-Reply-To: 1aSP8.91747$6m5.78798@rwcrnsc51.ops.asp.att.net

thanks :)


"SteveD" <nospam_steved94@attbi.com> wrote in message
news:1aSP8.91747$6m5.78798@rwcrnsc51.ops.asp.att.net...
> "kaak" <the_kaak@hotmail.com> wrote in message
> news:NfPP8.30076$9b.3149846@typhoon.austin.rr.com...
> > I'm curious about linked lists and pointers in ada. I'm not sure exactly
> how
> > they work.
> >
> > This is the code i have so far:
> >
> > procedure insertRear(header:in out ptr; x: integer) is
> >
> >         p: ptr;
> >         q: ptr;
> > BEGIN
> >         p = new node;
> >         p.key = x;
> >         q = header;
> >
> >         loop:
> >                 exit when q.next = null;
> >                 if q.next then
> >                         q = q.next;
> >                 else
> >                         exit;
> >                 end if;
> >         end loop;
> >
> >         q.next = p
> >
> > I don't think the syntax is right with the pointers. and ideas?
> >
> Here are a few hints:
>   In Ada assignment is done with the ":=" operator not "=".
>   The only value permitted as the condition of an if statement is an
> expression that evaluates to a boolean.
>   Labels end with a colon, the beginning of a loop does not.
>   If you try compiling the program, most compilers will direct you to
these
> simple errors.
>   If your program is small, go ahead and post a working example, you'll
> generally get a better response that way.  If your program is large, try
> creating a small version that reproduces just the part you have in
question.
>
> SteveD
>
>
>





      reply	other threads:[~2002-06-19  5:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-18 23:21 Linked List in ada kaak
2002-06-19  0:50 ` tmoran
2002-06-19  5:54   ` kaak
2002-06-19  7:46     ` tmoran
2002-06-19 16:10       ` Mark Johnson
2002-06-20  1:58     ` SteveD
2002-06-20  6:50       ` Adrian Hoe
2002-06-19  2:39 ` SteveD
2002-06-19  5:53   ` kaak [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