comp.lang.ada
 help / color / mirror / Atom feed
* Code Confusion.
@ 1997-11-02  0:00 Supreme
  1997-11-02  0:00 ` bklungle
  1997-11-04  0:00 ` Bill
  0 siblings, 2 replies; 3+ messages in thread
From: Supreme @ 1997-11-02  0:00 UTC (permalink / 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.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-11-04  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-02  0:00 Code Confusion Supreme
1997-11-02  0:00 ` bklungle
1997-11-04  0:00 ` Bill

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