hard20 pts · first answer countsswiftvalue-typesperformance
When a Swift array is copied
When is the array storage actually copied, and what does this code print?
var a = [1, 2, 3] var b = a // (1) b.append(4) // (2) print(a.count, b.count)
When is the array storage actually copied, and what does this code print?
var a = [1, 2, 3] var b = a // (1) b.append(4) // (2) print(a.count, b.count)