[fpc-pascal] EAccessViolation

Sven Barth pascaldragon at googlemail.com
Thu Aug 13 23:44:39 CEST 2015

Am 13.08.2015 22:17 schrieb "Michael Van Canneyt" <michael at freepascal.org>:
>>  if (i=0) then begin
>>    writeln ('node was empty / non existant');
>>    exit;
>>  end;
>>  for c:=0 to i do
>>      writeln (node[c]);    // line 85
> This should be
>   for c:=0 to i-1 do
>       writeln (node[c]);    // line 85

Or alternatively

for c := Low(node) to High(node) do


for n in node do // n is a var declared as String

Note: you can't modify array elements in the for-in-statement, as the
iterator variable merely contains a copy; however if the iterator variable
is a pointer type (or class/interface instance) then you can modify the
element's contents of course, but not the element itself (e.g. changing the
pointer value).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150813/f636d0fc/attachment.html>

More information about the fpc-pascal mailing list