0

Accessing Array Elements

int b[] = {11, 45, 62, 70, 88}; b[2] = 42; why b[2] = 42 and is not 62 ???

2nd Jun 2017, 5:31 PM
Frantseko Mystakidis
Frantseko Mystakidis - avatar
1 Réponse
+ 14
After the first line, the value of b[2] is definitely 62. But in the second line, you are assigning a new value to b[2] which is 42. So now the array elements are: 11, 45, 42, 70, 88
2nd Jun 2017, 5:37 PM
Shamima Yasmin
Shamima Yasmin - avatar