怎么给一个二维的动态数组定义上限呢?(10分)

  • 主题发起人 主题发起人 fengfan
  • 开始时间 开始时间
F

fengfan

Unregistered / Unconfirmed
GUEST, unregistred user!
请问:怎么给一个二维的动态数组定义上限呢?
比如: array1:array of array of string


我想得到 array1[10,8]这样的结果,该怎么赋值呢?还有怎么取的这个10 和8呢?



 
setleng();
定义上限
Sets the length of a string or dynamic-array variable.

Unit

System

Category

string handling routines

procedure SetLength(var S
NewLength: Integer);

Description

S is a string or dynamic-array variable.

For a short-string variable, SetLength simply sets the length-indicator character (the character at S[0]) to the given value. In this case, NewLength must be a value between 0 and 255.

For a long-string or dynamic-array variable, SetLength reallocates the string or array referenced by S to the given length. Existing characters in the string or elements in the array are preserved, but the content of newly allocated space is undefined. If there is not enough memory available to reallocate the variable, an EOutOfMemory exception is raised. Following a call to SetLength, S is guaranteed to reference a unique string or array梩hat is a string or array with a reference count of one.
 
使用setlength()的命令
 
>得到 array1[10,8]这样的结果,该怎么赋值呢?
SetLength(array1,10,8);

>还有怎么取的这个10 和8呢?
High(array1)-Low(array1)+1
//取得10;至于取得8,你可以行列转置,同样得到


 
接受答案了.
 

Similar threads

后退
顶部