MODULE RingListe; IMPORT Read, Write, Conclusions; TYPE List = POINTER TO ListRec; ListRec = RECORD content: INTEGER; next: List; END; VAR a, p: List; i, counter: INTEGER; BEGIN Write.Ln; a := NIL; counter := 1; WHILE counter <= 10 DO NEW(p); p.content := counter * counter; IF a = NIL THEN p.next := p; ELSE p.next := a.next; a.next := p; END; a := p; INC(counter); END; (* Die Ringliste sieht nun folgendermassen aus : * _____________________________ * | | * v | * p --> 10 --> 1 --> 2 --> 3 ... -> 9 - * ^ * | * a ----- *) (* a auf erstes Element (1) setzen *) a := p.next; (* Endlos Schleife, da Ringliste *) WHILE a # NIL DO Write.Int(a.content, 4); Write.Ln; a := a.next; END; Write.Ln; Write.Ln; END RingListe.