+ 1

Why does int n=3 ; n=++n + ++n; outputs n=10?

On implementation with python, c and JS I get different answers

5th Jan 2022, 6:33 PM
Felix Orinda
Felix Orinda - avatar
2 Answers
+ 1
Martin Taylor How does architecture affect pre/post increment operators. For compilers, sure, they are allowed to do whatever they want. But I'm yet to see a compiler that generates code that behaves differently on different architectures.
6th Jan 2022, 9:38 AM
Anthony Maina
Anthony Maina - avatar
0
1. Operator precedence and parentheses 2. Compulsory Type Conversion
5th Jan 2022, 6:51 PM
FanYu
FanYu - avatar