[fpc-pascal] Correct syntax for initialized constants/variables
Giuliano Colla
giuliano.colla at fastwebnet.it
Fri Apr 28 00:30:26 CEST 2017
Il 27/04/2017 20:49, Ralf Quint ha scritto:
> I see in the reference docs (section 4.4) examples for arrays and
> examples for records, but in my case, I would need to properly define an
> array of records.
>
> Any hint/example for the proper syntax in that case would be deeply
> appreciated, it's probably something simple that I am missing,
This comes from a working program, and the compiler didn't complain, so
I assume it is the correct syntax (the added comments are unnecessary,
of course):
> type
> Tentry = record
> bf: array [0..3] of Integer;
> sq: array [0..3] of Integer;
> ls: array [0..3] of Integer;
> ins:array [0..3] of Integer;
> end;
> var
> TTAB_XX: array[0..3] of Tentry = (
> { N=0 }
> { bf } (bf: (0,0,0,0);
> { sq } sq: (1,2,0,0);
> { ls } ls: (0,3,0,0);
> { ins} ins:(1,0,0,0)),
>
> { N=1 }
> { bf } (bf: (0,0,0,0);
> { sq } sq: (1,1,0,0);
> { ls } ls: (3,0,0,0);
> { ins} ins:(1,0,0,0)),
>
> { N=2 }
> { bf } (bf: (0,0,0,0);
> { sq } sq: (2,0,0,0);
> { ls } ls: (3,0,0,0);
> { ins} ins:(1,0,0,0)),
>
> { N=3 }
> { bf } (bf: (0,0,0,0);
> { sq } sq: (3,0,0,0);
> { ls } ls: (3,0,0,0);
> { ins} ins:(1,0,0,0)));
>
I hope that it helps,
Giuliano
More information about the fpc-pascal
mailing list