if you assign an arr[] to arrr[] . The modified first array will also be equal to the arrr[]? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

if you assign an arr[] to arrr[] . The modified first array will also be equal to the arrr[]?

Can someone explain why the arrr[] will also be modified when modifying the arr[] even though the assigning of the array happened before the modifying the arr[] array? Ill link the code. https://code.sololearn.com/cDvrUEt6ZQ0f/?ref=app

23rd Nov 2018, 10:56 PM
Ronald Allan Rupuesto
Ronald Allan Rupuesto - avatar
1 Answer
+ 2
Assignment operation will not make a copy of arr. It will reference the arr. So if you change the arr you change the reference and change arrr.
24th Nov 2018, 1:58 AM
Anya
Anya - avatar