I have 2 records like this:
TYPE
TRecord2= packed record
i2: Integer;
end;
TRecord1= packed record
i1: Integer;
R2: TRecord2;
end;
.
I want to initialize the record fields to zero but I don't want to use FillMemory so I declared 2 constant records in which I initialize the fields.
CONST
Record2c: TRecord2=
(
i2: 0;
);
Record1c: TRecord1=
(
i1: 0;
R2: Record2c; <------- error line
);
However, I cannot assign a Record2c to R2 field. The compiler says: E2029 '(' expected but identifier 'Record2c' found.
But this works (if I comment the line where I have the error):
procedure test;
var Record1: TRecord1;
begin
Record1:= Record1c; // initialize variable by associating the constant to it
end
So, how do i initialize the R2 field?