home *** CD-ROM | disk | FTP | other *** search
- -- Chapter 13 - Program 4
- with Text_IO, Unchecked_Deallocation;
- use Text_IO;
-
- procedure Access4 is
-
- package Int_IO is new Text_IO.Integer_IO(INTEGER);
- use Int_IO;
-
- type MY_ARRAY is array(3..8) of INTEGER;
- type POINT_TO_ARRAY is access MY_ARRAY;
-
- procedure Free is new
- Unchecked_Deallocation(MY_ARRAY,POINT_TO_ARRAY);
-
- List_Of_Stuff : MY_ARRAY := (34, 12, -14, 1, 27, -11);
- There : POINT_TO_ARRAY;
- Here : POINT_TO_ARRAY;
-
- begin
-
- There := new MY_ARRAY;
- There.all := List_Of_Stuff;
- Here := There;
-
- for Index in MY_ARRAY'RANGE loop
- Put(List_Of_Stuff(Index));
- Put(There.all(Index));
- Put(Here.all(Index));
- New_Line;
- end loop;
-
- Free(There);
-
- end Access4;
-
-
-
-
- -- Result of execution
-
- -- 34 34 34
- -- 12 12 12
- -- -14 -14 -14
- -- 1 1 1
- -- 27 27 27
- -- -11 -11 -11
-
-