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 to zero using a constant declaration like this:
CONST
Disk: RDisk=
(
R: ??
);
This is related to Record in record (Cannot initialize)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With