Files
pplus-web/mojo/corpus/quest/starters/MQ_901.mojo
T
2026-10-05 03:03:38 +00:00

13 lines
354 B
Mojo

from std.memory.alloc import unsafe_alloc
def main():
# Stage a single encoder reading in a scratch buffer.
# BUG: allocate, write the value, read it back, then release it.
var ptr = unsafe_alloc(1)
ptr.unsafe_write(copy=99)
var value = ptr[]
print("Encoder count:", value)
ptr.unsafe_deinit_pointee()
ptr.unsafe_free()