Previous topic | Next topic | Ada Home Page | Index

Linked Records

dynamic data structures involve records:

    type node;

    type link is access node;

    type node is record
        name : string (1..15);
        next : link;
    end;

Linking records

   P, Q, R : link;

Trace the effect of the following statements:

   P := new node'("Bessie Bunter  ", null);
   Q := new node'("Charlie Chaplin", null);
   R := new node'("Desmond Dekker ", null);
   P.next := Q;
   Q.next := R;
   P.next.next := new node;

Records are not usually linked using separate pointers like this. Instead, standard methods may be used to build a dynamic data structure called a linked list.


Previous topic | Next topic | Ada Home Page | Index
c-lokan@adfa.oz.au / 27 Feb 96