RosettaCodeData/Task/Create-a-two-dimensional-array-at-runtime/XPL0/create-a-two-dimensional-array-at-runtime.xpl0
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

9 lines
378 B
Text

inc c:\cxpl\codes; \(command words can be abbreviated to first 3 letters)
def IntSize=4; \number of bytes in an integer (2 or 4 depending on version)
int X, Y, A, I;
[X:= IntIn(0); Y:= IntIn(0); \get 2 dimensions from user
A:= Reserve(X*IntSize);
for I:= 0 to X-1 do A(I):= Reserve(Y*IntSize);
A(X/2, Y/2):= X+Y;
IntOut(0, A(X/2, Y/2)); CrLf(0);
]