RosettaCodeData/Task/Array-length/Ada/array-length.ada

17 lines
568 B
Ada
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
with Ada.Text_IO; use Ada.Text_IO;
2023-07-09 17:42:30 -04:00
with System;
2023-07-01 11:58:00 -04:00
procedure Array_Length is
2023-07-09 17:42:30 -04:00
2023-07-01 11:58:00 -04:00
Fruits : constant array (Positive range <>) of access constant String
:= (new String'("orange"),
new String'("apple"));
2023-07-09 17:42:30 -04:00
Memory_Size : constant Integer := Fruits'Size / System.Storage_Unit;
2023-07-01 11:58:00 -04:00
2023-07-09 17:42:30 -04:00
begin
Put_Line ("Number of elements : " & Fruits'Length'Image);
Put_Line ("Array memory Size : " & Memory_Size'Image & " bytes" );
Put_Line (" " & Integer'Image (Memory_Size * System.Storage_Unit / System.Word_Size) & " words" );
2023-07-01 11:58:00 -04:00
end Array_Length;