home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog2 / access1.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  865 b   |  47 lines

  1.                                        -- Chapter 13 - Program 1
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure Access1 is
  6.  
  7.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  8.    use Int_IO;
  9.  
  10.    type POINT_SOMEWHERE is access INTEGER;
  11.    Index,Arrow,There : POINT_SOMEWHERE;
  12.  
  13. begin
  14.    Index := new INTEGER;
  15.    Index.all := 13;
  16.    Put("The value is");
  17.    Put(Index.all);
  18.    New_Line;
  19.  
  20.    Arrow := new INTEGER;
  21.    Arrow.all := Index.all + 16;
  22.    There := Arrow;
  23.    Put("The values are now");
  24.    Put(Index.all);
  25.    Put(Arrow.all);
  26.    Put(There.all);
  27.    New_Line;
  28.  
  29.    There.all := 21;
  30.    Put("The values are now");
  31.    Put(Index.all);
  32.    Put(Arrow.all);
  33.    Put(There.all);
  34.    New_Line;
  35.  
  36. end Access1;
  37.  
  38.  
  39.  
  40.  
  41. -- Result of execution
  42.  
  43. -- The value is    13
  44. -- The values are now    13    29    29
  45. -- The values are now    13    21    21
  46.  
  47.