1. var a [10]int
  2. var a [3][4]int

slice

  1. a := []int{1, 2, 3, 0, 0}
  2. s := a[0:3:5]
  3. len(s) // 长度
  4. cap(s) // 容量
  1. s2 := make([]int, 5, 10)

append

  1. s := make([]int, 0, 1)
  2. s = appednd(s, 2)

copy

  1. srcSlice := []int{1, 2}
  2. dstSlice := []int{1, 2, 3, 4, 5}
  3. copy(dstSlice, srcSlice)