comp.lang.ada
 help / color / mirror / Atom feed
From: ucaa2385@alpha1.csv.ica.uni-stuttgart.de (Peter Hermann)
Subject: Re: Simple Pointer Problem, Help...
Date: 1996/05/24
Date: 1996-05-24T00:00:00+00:00	[thread overview]
Message-ID: <4o3vqj$3sgu@info4.rus.uni-stuttgart.de> (raw)
In-Reply-To: 4o2vu9$hdc@catapult.gatech.edu


Daniel J (gt7693d@acmex.gatech.edu) wrote:

>To any friendly programmer,

this sounds like "to a friendly Ada-Teamer" ;-)
so I give it a try :-)

> procedure AddNodeBack (Point : in out NumPtr;
>                          Value : in Integer) is
         p : numptr := point;
>     begin
        if p=null then
           Point := new NumRecord'(Value, null);
        else
           while  P.next /= null loop
             P := P.Next;    end loop;
                  P.next := new NumRecord'(Value, null);
        end if;
>    
>     end AddNodeBack;

>	The output of the body gives me one node, which is not what I want.

true ;-)

>I desire a linked list of N nodes w/values in ascending order, according to

you have indeed produced a linked list but you can't reach it  ;-)
The original pointer is ultimately destroyed in your original code :-(
Caution: the above piece of suggested code is not tested,
i.e. it is certainly wrong... as it is usual for the first trial ;-)
Daniel, it is your turn now to test and give me the correct solution
with all mumble-dee-bumble around
(I need a lot of working examples for my text-booklet).

--
Peter Hermann  Tel:+49-711-685-3611 Fax:3758 ph@csv.ica.uni-stuttgart.de
Pfaffenwaldring 27, 70569 Stuttgart Uni Computeranwendungen
Team Ada: "C'mon people let the world begin" (Paul McCartney)




      parent reply	other threads:[~1996-05-24  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-24  0:00 Simple Pointer Problem, Help Daniel J
1996-05-24  0:00 ` John Herro
1996-05-24  0:00 ` Peter Hermann [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