Array length: Difference between revisions
→{{header|Ada}}
No edit summary |
|||
Line 167:
=={{header|Ada}}==
<syntaxhighlight lang="ada">
with Ada.Text_IO; use Ada.Text_IO;
with System;
procedure Array_Length is
Fruits : constant array (Positive range <>) of access constant String
:= (new String'("orange"),
new String'("apple"));
Memory_Size : constant Integer := Fruits'Size / System.Storage_Unit;
begin▼
▲begin
Ada.Text_IO.Put_Line (" Array Size : " & Integer'Image (Fruits'Length));▼
Put_Line ("Number of elements : " & Fruits'Length'Image);
▲
Put_Line (" " & Integer'Image (Memory_Size * System.Storage_Unit / System.Word_Size) & " words" );
end Array_Length;</syntaxhighlight>
{{out}}
<pre>
Number of elements : 2
Array memory Size : 32 bytes
4 words
</pre>
=={{header|ALGOL 68}}==
|