Dear All,
First post here, so please be gentle

.
I am writing a pascal code that uses a number of dynamic arrays. After setting their length, I want to ensure all elements are zero, so I thought using FillChar would be perfect. However, it seems that FillChar then resets the length of these arrays to zero? Why? I couldn't not find anything on dynamic arrays nor on FillChar that explains why.
Things I've tried:
1) FillByte instead of FillChar
2) requesting different amounts of memory in FillChar (but I think it's correct like shown below)
any help would be very much appreciated.
This is a code that shows the problem. Fpc 3.2.2. on Linux Mint 21.2:
program testFillChar;
var r : array of real;
begin
SetLength(r, 10);
Writeln('length of r: ', Length(r));
writeln('size single element:', SizeOf(r));
FillChar(r, SizeOf(r) * Length(r), 0); {now make sure all elements are 0}
Writeln('after fillchar, length: ',Length(r))
end.
The output is:
length of r: 10
size single element:8
after fillchar, length: 0
Best wishes,
Jan-Anton