标签:rgs fun 个数 code col nbsp app color pen
new(T) 与 make(T, args)
合并数组
package main import ( "fmt" ) func main() { list := []int{} // new([]int) 返回的是指针,非集合,调append会报错 list = append(list, 1) fmt.Println(list) s1 := []int{1, 2, 3} s2 := []int{4, 5} s1 = append(s1, s2...) // 合并两个数组,必须带 “...” fmt.Println(s1) }
标签:rgs fun 个数 code col nbsp app color pen
原文地址:https://www.cnblogs.com/dzone/p/12103829.html