I have an array a
which is constantly being updated.
(我有一个数组a
被不断更新。)
a = [1,2,3,4,5]
. (假设a = [1,2,3,4,5]
。)
a
and call it b
. (我需要的精确副本a
并将其命名为b
。)
a
were to change to [6,7,8,9,10]
, b
should still be [1,2,3,4,5]
. (如果a
更改为[6,7,8,9,10]
,则b
仍应为[1,2,3,4,5]
。)
(做这个的最好方式是什么?)
I tried afor
loop like: (我尝试了像这样的for
循环:)
for(int i=0; i<5; i++) {
b[i]=a[i]
}
but that doesn't seem to work correctly.
(但这似乎无法正常工作。)
Please don't use advanced terms like deep copy, etc., because I do not know what that means.(请不要使用深层复制等高级术语,因为我不知道这意味着什么。)
ask by badcoder translate from so