On 24.09.2017 21:07, James Richters wrote:
> Thank you for explaining how to achieve this.
> I am curious about the meaning behind the prefixes you used:
>> TVGA256Array = Array[0..255] of VGARGBRec;
>> PVGA256Array = ^TVGA256Array;
> Do the T and P in front of VGA256Array have a special meaning or
> significance? I see things like that all the time, but never really
> understood why there are these designations.
"T" and "P" are simply the typical Hungarian notations in Pascal for
ordinary types and pointer types respectively.
> I should have mentioned that not all my arrays are [0..255], Most are, but I
> have some that are [0..15] and one that is [1..14] Is there a way to
> implement a variable size array and somehow use the array minimum and maximum
> element in the for loop?
If you use open array parameters you can do that. E.g.
=== code begin ===
program tdynarr;
const
Array1: array[0..3] of LongInt = (1, 2, 3, 4);
Array2: array[2..6] of LongInt = (1, 2, 3, 4, 5);
{ Important: a dynamic array type (aka "TArray = array of LongInt") for
the array parameter will only work with 0 based array constants (in this
case Array1) }
procedure DoArray(aArr: array of LongInt);
begin
Writeln(Low(aArr), '..', High(aArr));
end;
begin
DoArray(Array1);
DoArray(Array2);
end.
=== code end ===
Please note that an open array is always zero based so the output of the
above example will be:
=== output begin ===
0..3
0..4
=== output end ===
Regards,
Sven
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal