已经不再是简单的赋值了,而且数据拷贝!
func testArray(){ var a = [1,2,3,4]; var b = a; //a.append(100); var c = b; c[1] = 20; print(a); //[1,4] print(b); //[1,4] print(c); //[1,20,4] }原文链接:https://www.f2er.com/swift/321787.html
已经不再是简单的赋值了,而且数据拷贝!
func testArray(){ var a = [1,2,3,4]; var b = a; //a.append(100); var c = b; c[1] = 20; print(a); //[1,4] print(b); //[1,4] print(c); //[1,20,4] }原文链接:https://www.f2er.com/swift/321787.html