Create a two-dimensional array at runtime: Difference between revisions

m
fixed formatting glitch on ALGOL-M example
m (added ALGOL-M example)
m (fixed formatting glitch on ALGOL-M example)
Line 487:
</pre>
 
 
==={{header|ALGOL-M}}===
=={{header|ALGOL 68}}==
<syntaxhighlight lang="algol68">main:(
print("Input two positive whole numbers separated by space and press newline:");
[read int,read int] INT array;
array[1,1]:=42;
print (array[1,1])
)</syntaxhighlight>
 
==={{header|ALGOL-M}}===
<syntaxhighlight lang="ALGOL">
begin
Line 501 ⟶ 510:
begin % we need to start a new block %
integer array test[1:first, 1:second];
integer itest[1,1] := j99;
write("Stored value at 1,1 =",test[i1,j1]);
i := first - 1;
j := second - 1;
test[i,j] := 99;
write("Stored value =",test[i,j]);
end; % array is now out of scope %
 
Line 517 ⟶ 523:
Length of second dimension:
->7
Stored value at 1,1 = 99
</pre>
 
=={{header|ALGOL 68}}==
<syntaxhighlight lang="algol68">main:(
print("Input two positive whole numbers separated by space and press newline:");
[read int,read int] INT array;
array[1,1]:=42;
print (array[1,1])
)</syntaxhighlight>
 
=={{header|ALGOL W}}==
211

edits