I have an array a
which is constantly being updated. Let's say a = [1,2,3,4,5]
. I need to make an exact duplicate copy of a
and call it b
. If a
were to change to [6,7,8,9,10]
, b
should still be [1,2,3,4,5]
. What is the best way to do this? I tried a for
loop like:
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.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…