RosettaCodeData/Task/Memory-allocation/Nanoquery/memory-allocation.nanoquery

18 lines
301 B
Plaintext

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)