code wiki / (root) / smoke_str_arg.nx

smoke_str_arg.nx source

↩ module page · 13 lines · 305 B

1// smoke_str_arg.nx -- pass a string literal to a function, read first byte. 2 3import "syscalls.nx" 4 5func first_byte(s: *u8) -> i64 { 6 return s[0] 7} 8 9func main() -> i64 { 10 let v: i64 = first_byte("Z") 11 // 'Z' = 0x5A = 90. Should exit 90. 12 return __syscall(93, v, 0, 0, 0, 0, 0) 13}