string example
This commit is contained in:
12
examples/strings.zr
Normal file
12
examples/strings.zr
Normal file
@@ -0,0 +1,12 @@
|
||||
func print_i64[x: I64] : I64
|
||||
printf("%ld\n", x)
|
||||
|
||||
func i64_to_string[n: I64] : String
|
||||
let x: I64 = malloc(21)
|
||||
sprintf(x, "%d", n)
|
||||
return x
|
||||
|
||||
func main[] : I64
|
||||
let s: String = i64_to_string(58394)
|
||||
print_i64(strlen(s))
|
||||
free(s)
|
||||
Reference in New Issue
Block a user