What are the different ways of defining array sizes? - Delphi

What are the different ways of defining array sizes?



There are many ways in Delphi to define the size of the array and these are as follows:
- Days array: defines the fixed dimension from 1-7. It has indexing values that keeps the data indexed.

- The index range can be defined by using the type enumeration and sub-ranges according to the size that is being provided.

- The arrays defined below use the enumeration and sub-ranges that define the size of the array in an easy way like:

type
TCars = (Ford, Vauxhall, GM, Nissan, Toyota, Honda);
var
cars : array[TCars] of string;
japCars : array[Nissan..Honda] of string;
begin

- Here we define the enumeration values to properly index the values of the arrays and these are as follows:

japCars[Nissan] := 'Bluebird'; // Allowed
japCars[Ford] := 'Galaxy'; // Not allowed
end;
Post your comment