Arrays - interesting behavior | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

18th Oct 2017, 9:01 PM
ThreeG
ThreeG - avatar
1 Answer
18th Oct 2017, 9:02 PM
ThreeG
ThreeG - avatar