*/
Want to see what people are talking about? See the latest forum posts.
*/

View \POINT.PAS

This is the second disk of the PASCAL TUTOR system. It has the

Submitted By: WEBMASTER
Rating: (Not rated) (Rate It)


(* Chapter 12 - Program 1 *)
program First_Pointer_Example;

type Int_Point = ^Integer;

var Index         : Integer;
    Where         : ^Integer;
    Who           : ^Integer;
    Pt1, Pt2, Pt3 : Int_Point;

begin
   Index := 17;
   Where := Addr(Index);
   Who := Addr(Index);
   Writeln('The values are   ',Index:5,Where^:5,Who^:5);

   Where^ := 23;
   Writeln('The values are   ',Index:5,Where^:5,Who^:5);

   Pt1 := Addr(Index);
   Pt2 := Pt1;
   Pt3 := Pt2;
   Pt2^ := 151;
   Writeln('The Pt values are',Pt1^:5,Pt2^:5,Pt3^:5);
end.

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.