package main import "fmt" func main(){ var arr [3]int arr[0] = 42 arr[1] = 13 fmt.Print("first is %d\n", arr[0]) fmt.Print("second is %d\n", arr[1]) }运行结果如下:
正确的不是应该是
first is 42
second is 13
吗
helloworld:~/go/src/mathapp$ go build
helloworld:~/go/src/mathapp$ ls
main.go mathapp
helloworld:~/go/src/mathapp$ ./mathapp
first is %d
42second is %d
13helloworld:~/go/src/mathapp$
引用来自“过儿”的答案
fmt.Printf("second is %d\n", arr[1])