Address of a variable: Difference between revisions

Added Odin variant
No edit summary
(Added Odin variant)
Line 1,271:
let c = 17 in
Printf.printf "%nx\n" (address_of c);; (* error, because int is unboxed *)</syntaxhighlight>
 
=={{header|Odin}}==
 
<syntaxhighlight lang="odin">package main
 
main :: proc() {
i : int = 42
ip : ^int = &i // Get address of variable
 
address := uintptr(0xdeadf00d)
ip2 := cast(^int)address // Set the address
}</syntaxhighlight>
 
=={{header|Oforth}}==
29

edits