Address of a variable

From Rosetta Code
Revision as of 03:01, 27 February 2007 by rosettacode>Waldorf (New page: {{task}} Demonstrate how to get the address of a variable and how to set the address of a variable. ==Ada== Category:Ada ===Get The Address=== The_Address : System.Address; I : ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Task
Address of a variable
You are encouraged to solve this task according to the task description, using any language you may know.

Demonstrate how to get the address of a variable and how to set the address of a variable.

Ada

Get The Address

The_Address : System.Address;
I : Integer;
The_Address := I'Address;

Set The Address

Set the address of a variable to address A100 in hexidecimal

I : Integer;
for I'Address use 16#A100#;

Set the address of one varible to the address of another variable, creating an overlay.

I : Integer;
J : Integer;
For I'Address use J'Address;