Talk:Dynamic array
From Free Pascal wiki
Jump to navigationJump to searchI was a little bit confused about the sentence "To init such an invalid pointer you have to use FillChar(MyVariable,sizeof(MyVariable), #0)." This might be misleading, as this fills the pointer to MyVariable with the size of this pointer with zeros, not the array itself, as far as I understand. This might be different to static arrays (didn't prove that).
Anyway: It took me some time to find out, how to initialize the array itself: FillChar(MyVariable[0], Length(MyVariable) * SizeOf(TheArrayType), #0);
Perhaps this difference between initializing the array itself and the reference to the array should be emphasized? Or did I misunderstand something there?