go 的典型append追加问题

Crazy-Geng · 2018-11-15 10:47:45 · 1986 次点击

因为res 是引用类型。 可以理解为append 只是把 指向res对象的指针append 到了ret中。 每次修改 res 的值,引用res的相关数据都会变化。

#2