Memory allocation: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
(Added Odin variant) |
||
Line 1,085:
foo_array := Int->New[size]; // allocates an integer array on the heap
x := 0; // allocates an integer on the stack</syntaxhighlight>
=={{header|Odin}}==
<syntaxhighlight lang="odin">package main
import "core:mem"
main :: proc() {
ptr := mem.alloc(1000) // Allocate heap memory
mem.free(ptr)
}</syntaxhighlight>
=={{header|Oforth}}==
|