0
Int x = 3; x = ++× + x++ + x++; x = ? Can someone please explain this to me. I get 13 , shouldn't it be 14?
C language
4 ответов
+ 4
A decent compiler should show you a warning, telling you that evaluation of <variable-name> may be undefined. The idea of modifying data while accessing it altogether at the same point is no good practice, as the order of modification and access is not defined.
Please refer this for more details 👇
https://stackoverflow.com/questions/4176328/undefined-behavior-and-sequence-points
0
X = ++x + x++ + x++
X = 4 (pre increament) + 4(post inc) + 5(post inc)
And if you print x; it would be 6
0
The compiler gives me 13 !
0
That is what i said. 4+4+5=13