Page 1 of 1

Posted: 30 Dec 2008, 17:03
by nelson
its possible to make 2-dim. dynamic array?

d:array of array of integer;

how to set dimmenstions of array in script?

Posted: 30 Dec 2008, 20:02
by bmoussay
Hi,

Have you tried:

type X: array of integer ;
var Y: array of X;
var i: integer;

for i:= 0 to n do
begin
Y:=X;
end;

Hope it can help,

Regards,

B.

Posted: 31 Dec 2008, 15:10
by amiga909
dynamic array structures: there is nothing like that in the core elements of pascal script.
however you could build it a list/set-type thing with a procedure yourself - if needed.

set array lengths: there is setArrayLength(array, int)
// declaration as bmoussay wrote

// init a 16x16 matrix with value 1
setArrayLength(Y, 16);
FOR i := 0 TO 15 DO BEGIN
setArrayLength(Y, 16);
FOR j:=0 TO 15 DO BEGIN
Y[j]:=1;
END;
END;

Posted: 04 Jan 2009, 20:31
by amiga909
bmoussay wrote:Hi,

Have you tried:

type X: array of integer ;
btw: should be
type X =array of integer; // '=' instead of ':'
var Y : array of X;