RosettaCodeData/Task/Create-a-two-dimensional-ar.../XPL0/create-a-two-dimensional-ar...

10 lines
378 B
Plaintext

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);
]