-- Chapter 13 - Programming Exercise 2 -- Chapter 13 - Program 1 with Ada.Text_IO, Ada.Integer_Text_IO, Unchecked_Deallocation; use Ada.Text_IO, Ada.Integer_Text_IO; procedure Ch13_2a is type POINT_SOMEWHERE is access INTEGER; Index,Arrow,There : POINT_SOMEWHERE; procedure Free is new Unchecked_Deallocation(INTEGER, POINT_SOMEWHERE); begin Index := new INTEGER; Index.all := 13; Put("The value is"); Put(Index.all, 5); New_Line; Arrow := new INTEGER; Arrow.all := Index.all + 16; There := Arrow; Put("The values are now"); Put(Index.all, 5); Put(Arrow.all, 5); Put(There.all, 5); New_Line; There.all := 21; Put("The values are now"); Put(Index.all, 5); Put(Arrow.all, 5); Put(There.all, 5); New_Line; Free(Index); Free(Arrow); end Ch13_2a; -- Result of execution -- The value is 13 -- The values are now 13 29 29 -- The values are now 13 21 21 -- Note that the Free procedure in line 41 could have been done -- with the access variable There since it is also accessing -- that data. Both could not be used however.