Create an object at a given address: Difference between revisions
Added Delphi example
(added Perl programming solution) |
MaiconSoft (talk | contribs) (Added Delphi example) |
||
Line 291:
arr[3] = 0x3f000000 ( 0.5000) @ 0x401C2F8C
</pre>
=={{header|Delphi}}==
<lang Delphi>
program Create_an_object_at_a_given_address;
{$APPTYPE CONSOLE}
var
origem: Integer;
copy: Integer absolute origem; // This is old the trick
begin
writeln('The "origem" adress is: ', cardinal(@origem));
writeln('The "copy" adress is: ', cardinal(@copy));
writeln;
origem := 10;
writeln('Assign 10 to "origem" ');
writeln('The value of "origem" é ', origem);
writeln('The value of "copy" é ', copy);
writeln;
copy := 2;
writeln('Assign 2 to "copy" ');
writeln('The value of "origem" é ', origem);
writeln('The value of "copy" é ', copy);
Readln;
end.</lang>
{{out}}
<pre>The "origem" adress is: 4261256
The "copy" adress is: 4261256
Assign 10 to "origem"
The value of "origem" é 10
The value of "copy" é 10
Assign 2 to "copy"
The value of "origem" é 2
The value of "copy" é 2</pre>
=={{header|Forth}}==
|