comp.lang.ada
 help / color / mirror / Atom feed
From: Supreme <david@eng.ua.edu>
Subject: Code Confusion.
Date: 1997/11/02
Date: 1997-11-02T00:00:00+00:00	[thread overview]
Message-ID: <345CD154.1249E04E@eng.ua.edu> (raw)


In the following program I am trying to display the values of linked
list instead my output is
80 80 80 80 80 80
instead of 40 50 60 70 80.
here it is.
procedure problem is
    type LIST_NODE;
    type NODE_PTR is access LIST_NODE;
    type LIST_NODE is record
                NUM : INTEGER;
                NEXT : NODE_PTR;
     end record;

HEAD,P  : NODE_PTR;
N, NUM_NODES : INTEGER;
begin -- lab10A
    Put("Please enter the the values of the nodes");
Get( Num_Nodes);
Head := new NODE;
New_Line;
P := Head;
    for K in 2..NUN_NODES loop
Head.Next := P;
P.ALL.NUM := N;
P := P.Next;
end loop;
    Will this allow teh user to assing 20 30 40 50 etc to the linked
list?
in other words
Head.Next := P Should point the Head.next to the Pointer P and
then P.ALL.NUM :=N should be set to the value of N  ( entered by the
user)
then P := P.Next should allow N to be assigned to the next pointer.
is this right??
Peace.





             reply	other threads:[~1997-11-02  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-02  0:00 Supreme [this message]
1997-11-02  0:00 ` Code Confusion bklungle
1997-11-04  0:00 ` Bill
replies disabled

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