+ 5
Arrays - interesting behavior
Some time ago I encountered a weird situation - I created array and assinged it to the other, then I changed one element in first array, but the second array has changed too! I was wondering why it behave like this, because when I did it with variables it didn't happened. But later I realized that names of arrays are pointing the same address in the memory, so when I re-declare first array it points a new address in memory. Did you knew about this? You can tell more about it or correct me if am I wrong :D
1 Antwort
+ 5
Here is example code
https://code.sololearn.com/WqIsZDa4eEev/?ref=app