avatar

Andres Jaimes

Working with dynamic arrays in Delphi

One advantage of Delphi’s dynamic arrays is that they are automatically freed once they go out of scope. That simplifies memory management and gives you more flexibility on your applications. You can declare a dynamic array like this: Customers: array of string;  Before adding an element, you have to call the SetLength function to specify the number of elements you are going to use (3 in this case): SetLength(Customers, 3);  Now you can go ahead adding values: