Variable size/Get

Revision as of 03:20, 27 February 2007 by rosettacode>Waldorf (New page: {{task}} Demonstrate how to get the size of a variable. ==Ada== Category:Ada Ada represents the size of a variable in bits, not bytes like many other languages. Int_Bits : consta...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Demonstrate how to get the size of a variable.

Task
Variable size/Get
You are encouraged to solve this task according to the task description, using any language you may know.

Ada

Ada represents the size of a variable in bits, not bytes like many other languages.

Int_Bits : constant Integer := Integer'size;
Whole_Bytes : constant Integer := Int_Bits / Storage_Unit; -- Storage_Unit is the number of bits per storage element