home *** CD-ROM | disk | FTP | other *** search
- 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
- From: damm@diku.dk (Kristian Damm Jensen)
- Newsgroups: comp.lang.pascal
- Subject: Re: pointers to arrays?!?
- Message-ID: <1993Jan11.151014.6767@odin.diku.dk>
- Date: 11 Jan 93 15:10:14 GMT
- References: <1993Jan11.205412.1@cc.newcastle.edu.au>
- Sender: damm@rimfaxe.diku.dk
- Organization: Department of Computer Science, U of Copenhagen
- Lines: 27
-
- glgam@cc.newcastle.edu.au (GLGAM) writes:
-
- >Suppose I had setup a pointer to an array on the heap... How do I access the
- >individual elements ?
-
- >ie.
-
- >Type
- > ArrayType = Array[1..Max] of Char;
-
- >Var
- > ArrayVar : ^ArrayType;
- > Index : Word;
-
- >[..]
-
- >ArrayVar[Index]^ := etc..????
-
- >Doesn't work.. I know why.. I just can't for the life of me figure
- >out what _does_ work..
-
- ArrayVar is a pointer, so in order to access the object it points sto
- you append a ^ to it. ArrayVar^ is an array. Now index.
- --
- Kristian Damm Jensen (damm@diku.dk)
- "Life is like a sewer - what you get out of it depends on what you put into it"
- - Tom Lehrer
-