RosettaCodeData/Task/Memory-allocation/Nanoquery/memory-allocation.nanoquery
2023-07-01 13:44:08 -04:00

17 lines
301 B
Text

import native
// allocate 26 bytes
ptr = native.allocate(26)
// store the uppercase alphabet
for i in range(0, 25)
native.poke(ptr + i, ord("A") + i)
end
// output the allocated memory
for i in range(0, 25)
print chr(native.peek(ptr + i))
end
// free the allocated memory
native.free(ptr)