github.com/goplus/llgo@v0.8.3/cl/_testrt/index/in.go (about) 1 package main 2 3 import "github.com/goplus/llgo/internal/runtime/c" 4 5 type point struct { 6 x int 7 y int 8 } 9 10 func main() { 11 a := [...]point{{1, 2}, {3, 4}, {5, 6}}[2] 12 c.Printf(c.Str("%d %d\n"), a.x, a.y) 13 14 b := [...][2]int{[2]int{1, 2}, [2]int{3, 4}}[1] 15 c.Printf(c.Str("%d %d\n"), b[0], b[1]) 16 17 var i int = 2 18 n := [...]int{1, 2, 3, 4, 5}[i] 19 c.Printf(c.Str("%d\n"), n) 20 c.Printf(c.Str("%d\n"), [...]int{1, 2, 3, 4, 5}[i]) 21 22 s := "123456" 23 c.Printf(c.Str("%c\n"), s[i]) 24 c.Printf(c.Str("%c\n"), "123456"[1]) 25 }