What is the function of Dynamic arrays? - Delphi

What is the function of Dynamic arrays?



- Dynamic arrays are the array type that defines their sizes at runtime or according to the data entered.

- The dynamic arrays are declared and defined as shown below:

var
wishes : array of string;
begin
SetLength(wishes, 3);
end;

- SetLength is a routine that is used to set the array size according to the string entered.

- The size of the string or the input is defined at runtime that is why it is called dynamic arrays.

- The array size can be changed and decreased or increased according to the requirements.

- Dynamic arrays starts with an index 0 and it can grow according to the need of the input.
Post your comment