runtime: StringCat

This commit is contained in:
xushiwei
2024-05-01 22:00:34 +08:00
parent 52a64a7770
commit cf02f4a34f
5 changed files with 132 additions and 13 deletions

View File

@@ -4,6 +4,14 @@ import (
"github.com/goplus/llgo/internal/runtime/c"
)
func main() {
c.Fprintf(c.Stderr, c.Str("Hello %d\n"), 100)
func concat(args ...string) (ret string) {
for _, v := range args {
ret += v
}
return
}
func main() {
result := concat("Hello", " ", "World")
c.Fprintf(c.Stderr, c.Str("Hello %s\n"), c.AllocaCStr(result))
}