Create a two-dimensional array at runtime: Difference between revisions
Create a two-dimensional array at runtime (view source)
Revision as of 20:18, 1 August 2023
, 10 months agofixed 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>▼
<syntaxhighlight lang="ALGOL">
begin
Line 501 ⟶ 510:
begin % we need to start a new block %
integer array test[1:first, 1:second];
▲ 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}}==
|