28 lines
492 B
Plaintext
28 lines
492 B
Plaintext
heap :: import "@std/mem/heap"
|
|
|
|
printf c_func(fmt *c_char, ...) c_int
|
|
|
|
main func() i32 {
|
|
memory ?*mut u8 = heap.alloc(4)
|
|
defer heap.free(memory)
|
|
|
|
if memory |bytes| {
|
|
bytes[0] = 10
|
|
bytes[1] = 20
|
|
bytes[2] = bytes[0] + bytes[1]
|
|
|
|
_ = printf("bytes[0]: %d\n", bytes[0])
|
|
_ = printf("bytes[1]: %d\n", bytes[1])
|
|
_ = printf("bytes[2]: %d\n", bytes[2])
|
|
_ = printf("bytes[3]: %d\n", bytes[3])
|
|
|
|
if (bytes[2] != 30) {
|
|
return 2
|
|
}
|
|
|
|
return 0
|
|
}
|
|
|
|
return 1
|
|
}
|