Hello,
I have a basic question concerning strings and array memory representation in GPC. To my amusement I noticed that in the following program the string assigned to an array element cannot be then restored from the array itself. So probably an array of strings is not represented in memory just like an array of simple type, and cannot (?) be simply getmem-ed ?
program test; type NameStr=String[8]; shortarray=array[1..3] of NameStr;
var n:NameStr; a:^shortarray; i:integer;
begin getmem(a,3*sizeof(NameStr)); n:='12345678'; for i:=1 to 3 do begin a^[i]:=n; writeln('n = ',n) writeln('a^[i] = ',a^[i]); end; end.
As a result the value of a^[i] is an empty string after the assignment; I will be very grateful for any answers or comments (I use gpc version 20010502, based on 2.95.3 20010315). Regards, Adam Naumowicz
-------------------------------------- WWW: http://math.uwb.edu.pl/~adamn/ --------------------------------------