+ 10

Why the value of a is equal to 10?

Even the "a" is not modified why the value is changed. https://code.sololearn.com/c66s2Mt7he9P/?ref=app

31st Jan 2019, 1:06 PM
Ajay Jagini
Ajay Jagini - avatar
3 Antworten
+ 6
b is an array of 2 elements, but b[3] = 10 changes memory outside of its index range, resulting in undefined behavior. Here, the memory space of b[3] is the same as the variable a.
31st Jan 2019, 1:40 PM
Zen
Zen - avatar
31st Jan 2019, 2:43 PM
Earl_Grey
Earl_Grey - avatar
+ 1
a[3]=10
7th Mar 2019, 3:44 PM
Vignesh N
Vignesh N - avatar