Wed, 18 Jun 1902 08:00:00 GMT
Pointers to pointers
QuoteJohn Matthews <j...@johnmatthews.demon.co.uk> wrote: >All my arrays are on the heap, and each element is a variable which points >to the data like so..... Name[index]^.address but if I have 10,000 >names that will take up 40,000 bytes. How do I TYPE the whole array on >the heap with just a 4 byte pointer referencing the base of the array. And >when I have done that, how do I use the code in practice?
Type OneName = ^String; { this is pointer to actual data } NameList = array [0..10000] of OneName; { list of pointers } Var Name : ^NameList; { pointer to name list } I : Integer; Begin { assume you already initialized all data } I:=0; While Name^[I]<>Nil do Begin Writeln(Name^[i]^ ); Inc(I); End; End. * Anders LEE and...@hk.super.net * http://www.hk.super.net/~anders
|