0

Array

in an array b[]={1,2,3,4,5}, when we assign new value suppose b[2]=10; then would it replace 3 by 10 or create an array with values {1,2,10,3,4,5}. similarly if in array b[5]={1,2,3,4,5}, b[2]=10; is assigned, what would happen?

27th Sep 2017, 8:14 AM
Urvashi Sharma
Urvashi Sharma - avatar
1 ответ
+ 11
In both cases, it will only replace the element at the given index, in your case 2, and not create a new separate array everytime. 😇
27th Sep 2017, 8:37 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar