home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / pascal / 6804 < prev    next >
Encoding:
Text File  |  1992-11-21  |  886 b   |  39 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!csd.unb.ca!mta.ca!TCSMITH
  3. From: tcsmith@mta.ca (Tim Smith)
  4. Subject: Pointer problems...
  5. Message-ID: <1992Nov21.181025.18275@jupiter.sun.csd.unb.ca>
  6. Sender: news@jupiter.sun.csd.unb.ca
  7. Reply-To: tcsmith@mta.ca
  8. Organization: Mount Allison U, Sackville, N.B. Canada 
  9. Date: Sat, 21 Nov 1992 18:10:25 GMT
  10. Lines: 27
  11.  
  12.   I wonder if someone could please explain why these pointer operations don't work...
  13. {*****problem 1**********************}
  14. var
  15.   p1: ^byte;
  16.   p2: ^byte;
  17.   p3   : pointer;
  18. begin
  19.   getmem(p3,100);
  20.   p1:=P3;
  21.   p2:=addr(p1);
  22.  
  23.   writeln(p1^,' ',p2^,' ');
  24.           ^^^-----^^^ Why won't these two values be equal?
  25.   freemem(p3,100);
  26. end.
  27.  
  28. {*****problem 2**********************}
  29. var
  30.   P1 : ^Byte;
  31.   P2 : ^Byte;
  32. begin
  33.   new(p1);
  34.   p2:=p1;   { Why is this illegal }
  35.  
  36.   dispose(p1);
  37. end.
  38.  
  39.