home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PASSRC.ZIP / POINT.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-04  |  744b  |  37 lines

  1.                                       (* Chapter 12 - Program 1 *)
  2. program First_Pointer_Example;
  3.  
  4. type Int_Point = ^Integer;
  5.  
  6. var Index         : Integer;
  7.     Where         : ^Integer;
  8.     Who           : ^Integer;
  9.     Pt1, Pt2, Pt3 : Int_Point;
  10.  
  11. begin
  12.    Index := 17;
  13.    Where := Addr(Index);
  14.    Who := Addr(Index);
  15.    Writeln('The values are   ',Index:5,Where^:5,Who^:5);
  16.  
  17.    Where^ := 23;
  18.    Writeln('The values are   ',Index:5,Where^:5,Who^:5);
  19.  
  20.    Pt1 := Addr(Index);
  21.    Pt2 := Pt1;
  22.    Pt3 := Pt2;
  23.    Pt2^ := 15;
  24.    Writeln('The Pt values are',Pt1^:5,Pt2^:5,Pt3^:5);
  25. end.
  26.  
  27.  
  28.  
  29.  
  30. { Result of execution
  31.  
  32. The values are      17   17   17
  33. The values are      23   23   23
  34. The Pt values are   15   15   15
  35.  
  36. }
  37.