Hi,
I've read that in Oberon-07 we can't have a pointer to an array, and I was
wondering how we can set the size of an array at runtime. I want to do
something similar to the below code snippet:
MODULE Test;
(*Oberon-2 compatible*)
IMPORT In,Out;
VAR
PA:POINTER TO ARRAY OF INTEGER;
N,Input,I:INTEGER;
BEGIN
Out.String("Size of array: "); Out.Ln;
In.Int(N);
NEW(PA,N);
Out.String("Enter Items: "); Out.Ln;
FOR I := 0 TO N-1 DO
In.Int(Input);
PA[I] := Input;
END;
FOR I := 0 TO N-1 DO
Out.Int(PA[I],0);
Out.Char(' ');
END;
Out.Ln;
END Test.