Newsgroups: comp.lang.pascal Path: utzoo!utgpu!watserv1!watmath!nmouawad From: nmouawad@watmath.waterloo.edu (Naji Mouawad) Subject: Re: need dynamic array on heap Message-ID: <1991Apr14.205511.11509@watmath.waterloo.edu> Organization: University of Waterloo References: <1991Apr12.234843.9031@ux1.cso.uiuc.edu> Date: Sun, 14 Apr 1991 20:55:11 GMT Lines: 39 In article <1991Apr12.234843.9031@ux1.cso.uiuc.edu> amead@s.psych.uiuc.edu (alan mead) writes: >I want to put aside a chunk of the heap and then index it by byte like >an array of byte. I could just declare it as some type like >'array[1..64000] of byte', but I want to use GetMem so that the array will >really be dynamic (I don't want to use 64K each time). > >So, I'm trying this: > >program Test; > type > C_arrayType = array[1..1] of byte; > var > Buff : ^C_arrayType; > begin > GetMem( Buff,1000 ); > Buff[1]^ := 2; > end. > >But I get > > Buff[1]^ := 2; > ^ Invalid qualifier > try Buff^[1] := 2; You are using a pointer to an array. Thus, you point first to the array and then you index it. >Thanks, > >-alan mead : amead@s.psych.uiuc.edu --Naji. -- ------------------------------------------------------------------- | Naji Mouawad | nmouawad@watmath.waterloo.edu | | University |---------------------------------------------------| | Of Waterloo | "The Stranger in us is our most familiar Self" |