+ 7
Completely agreed with Ipang the increment decrement problem is compiler dependent various compiler convert or read the increment in sequence in different order like (++b, b), b++ (++b), (b, b++) And other options as applicable according to the compiler and execute that
28th May 2019, 11:50 AM
MsJ
MsJ - avatar
+ 5
It is not possible to "judge" which compiler is correct or not, the output of typical code where a variable value is accessed and modified multiple times (like your code) is compiler dependent, it is not a wonder why you get different output on different compiler, as commonly termed - undefined behaviour. Tips: Avoid accessing and modifying a variable's value multiple times in a sequence point.
28th May 2019, 11:42 AM
Ipang
+ 3
when multiple operation is carried out in a single variable something happen which is known as sequence point, which brings about undefined behavior, which I think Ipang have explained vividly
28th May 2019, 4:29 PM
✳AsterisK✳
✳AsterisK✳ - avatar
0
I think a similar problem with different increment results was discussed here in great detail: "Can you explain the output!" https://www.sololearn.com/discuss/1800527/?ref=app
29th May 2019, 5:00 AM
Michael U.
Michael U. - avatar