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,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,de06245437f9462 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-18 19:39:58 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!wn4feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail From: "SteveD" Newsgroups: comp.lang.ada References: Subject: Re: Linked List in ada X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <1aSP8.91747$6m5.78798@rwcrnsc51.ops.asp.att.net> NNTP-Posting-Host: 12.225.227.101 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1024454397 12.225.227.101 (Wed, 19 Jun 2002 02:39:57 GMT) NNTP-Posting-Date: Wed, 19 Jun 2002 02:39:57 GMT Organization: AT&T Broadband Date: Wed, 19 Jun 2002 02:39:57 GMT Xref: archiver1.google.com comp.lang.ada:26340 Date: 2002-06-19T02:39:57+00:00 List-Id: "kaak" 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