Create an object at a given address: Difference between revisions
Create an object at a given address (view source)
Revision as of 08:48, 7 October 2023
, 8 months agoInitial FutureBasic task solution added
imported>Acediast (→{{header|COBOL}}: record restructure for simplicity) |
(Initial FutureBasic task solution added) |
||
Line 530:
Teresa 60
</pre>
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
include "NSLog.incl"
local fn DoIt
NSLog( @"Dimension in integer \"x\", but do not assign it a value.\n" )
long x
// Note that the @ (at sign) prefixing x is a pointer to its machine address
NSLog( @"The machine address of x is: %p", @x )
NSLog( @"While x is unassigned, the machine address will contain a garbage value: %ld\n", x )
// Assign x a value of 1234
x = 1234
NSLog( @"When x is assigned a value of %ld, that value will be stored in the machine address: %p", x, @x )
NSLog( @"The machine address now contains the value: %ld\n", x )
// Reassign x a value of 5678
x = 5678
NSLog( @"Wnen x is reassigned the new value %ld, that value will be stored in the existing machine address: %p", x, @x )
NSLog( @"The machine address now contains the value: %ld\n", x )
end fn
fn DoIt
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
Dimension in integer "x", but do not assign it a value.
The machine address of x is: 0x7ffee279bb58
While x is unassigned, the machine address will contain a garbage value: 1099524915200
When x is assigned a value of 1234, that value will be stored in the machine address: 0x7ffee279bb58
The machine address now contains the value: 1234
Wnen x is reassigned the new value 5678, that value will be stored in the existing machine address: 0x7ffee279bb58
The machine address now contains the value: 5678
</pre>
=={{header|Go}}==
|