Jump to content
Tuts 4 You

[Delphi] Variables in statement


iLuvCoding92

Recommended Posts

iLuvCoding92

How to I create a variable in the statement(between the begin and end;) instead of before the statement? I don't want to waste a lot unused array. I want the program to be able to change the no. of array during runtime.

Link to comment

Ok, then use dynamic arrays.

procedure YourProcedure;
var
MyDynamicArray : array of Integer;begin
SetLength(MyDynamicArray,100); // This allocates dynamically memory for your array
....
// some operations with the array
....
....
SetLength(MyDynamicArray,0);
// Now you haven't any allocated memory for the array
....
....
end;

Best regards

Nacho_dj

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...