home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 8035 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  1.1 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!uwm.edu!spool.mu.edu!hri.com!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!dkuug!diku!damm
  2. From: damm@diku.dk (Kristian Damm Jensen)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: pointers to arrays?!?
  5. Message-ID: <1993Jan11.151014.6767@odin.diku.dk>
  6. Date: 11 Jan 93 15:10:14 GMT
  7. References: <1993Jan11.205412.1@cc.newcastle.edu.au>
  8. Sender: damm@rimfaxe.diku.dk
  9. Organization: Department of Computer Science, U of Copenhagen
  10. Lines: 27
  11.  
  12. glgam@cc.newcastle.edu.au (GLGAM) writes:
  13.  
  14. >Suppose I had setup a pointer to an array on the heap...  How do I access the
  15. >individual elements ?
  16.  
  17. >ie.
  18.  
  19. >Type
  20. >   ArrayType = Array[1..Max] of Char;
  21.  
  22. >Var
  23. >   ArrayVar  : ^ArrayType;
  24. >   Index     : Word;    
  25.  
  26. >[..]
  27.  
  28. >ArrayVar[Index]^ := etc..????
  29.  
  30. >Doesn't work..  I know why..  I just can't for the life of me figure
  31. >out what _does_ work..
  32.  
  33. ArrayVar is a pointer, so in order to access the object it points sto
  34. you append a ^ to it. ArrayVar^ is an array. Now index.
  35. -- 
  36. Kristian Damm Jensen (damm@diku.dk)
  37. "Life is like a sewer - what you get out of it depends on what you put into it"
  38. - Tom Lehrer
  39.