首页 > V2EX > V2EX-请教下为啥没添加进去
2022
12-09

V2EX-请教下为啥没添加进去

ophunter:

func testMatrix(res *[][]int) {
   r := *res
   r = append(r, []int{1, 2, 3})
}

fun main(){
   res := make([][]int, 0)
   testMatrix(&res)
   fmt.Println(res)
}

这个 res 为啥是空的 []

from V2EX-最新主题 https://ift.tt/k6NzDgw

最后编辑:
作者:分享菌
这个作者貌似有点懒,什么都没有留下。

留下一个回复