On 26 May 2011, at 23:18, Luis Fernando Del Aguila Mejía wrote: > How fill of the same value a dynamic array? > > {$codepage utf8} > Var A,B:array of word; > i:integer; > Begin > SetLength(A,10); > SetLength(B,10); > > FillWord(A[0],2*10,0); //when value diferent to zero, no runtime error
FillWord fills per word (= 16 bit). So you are filling 2*10 = 20 words, while you only allocated 10. Use fillchar if you want to specify the number of bytes. Jonas_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal