16 lines
319 B
Plaintext
16 lines
319 B
Plaintext
import "@ffi/c"
|
|
import "@std/mem"
|
|
|
|
main func() void {
|
|
allocator :: mem.c_allocator
|
|
|
|
data :: mem.alloc(u8, allocator, 24) catch |_| {
|
|
_ = c.printf("Failed to allocate memory\n")
|
|
return
|
|
}
|
|
defer mem.free(u8, allocator, data)
|
|
|
|
data[0] = 'H'
|
|
_ = c.printf("data[0] = %s\n", data[0])
|
|
}
|