Let\'s say I have this declaration:
TYPE
RDisk= packed record
R2: array[1..1024] of Byte;
etc
etc
end;
How do I initialize R2 t
You can declare a constant of type R2
and initialize it to all zeros like this:
const
zeros: R2 = (0, 0, 0, ...);
The array length is 1024, so you must specify all 1024 comma-separated values in that list.
You can initialize an array with zero using this
ZeroMemory(@R2[0],length(R2));
or this
FillChar(R2[0],length(R2),0);
Omit the fields you want to zero:
type
RDisk= packed record
R2: array[1..512] of Byte;
I: Integer;
D: Double;
R3: array[1..512] of Byte;
end;
const
Disk: RDisk=
(
I: 3;
D: 2.5;
);
or,
const
Disk: RDisk=
(
);
I don't know why it works, it doesn't quite fit in Record Constants' documentation.