[fpc-pascal] problem with array of string
Marco van de Voort
marcov at stack.nl
Mon Dec 20 22:27:12 CET 2004
> I have problem with two dimension array of string
>
> my program:
>
> procedure testlinie;
> var
> linie : array[0..1,0..100] of shortstring;
> i,ii : integer;
> begin
> fillchar(linie,sizeof(linie),0);
> for i := 0 to 1 do begin
> for ii:= 1 to 10 do begin
> linie[i,ii]:= linie[i,ii]+char(64+ii);
> writeln(i:5,ii:5,linie[i,ii]) ;
>
> end;
> end;
> end;
>
> during execution output is:
> 0 1 A
> 0 2 B
> 0 3 C etc.
This seems the correct output to me. Note that the inner loop never runs
twice for the same values of i and ii, so longer strings can't be formed.
> but should be:
> 0 1 A
> 0 2 AB
> 0 3 ABC
>
> on Delphi all works OK.
Are you sure? With 100% the same source?
More information about the fpc-pascal
mailing list