+ 1

A question about the order of operations.

Hello everyone, I thank you for taking the time to view my post. Anyway, into the main point. if x = 7 and y = -3 why does z = ++x + y-- - ++y outputting 9? 8 + (-3) - (-2) is supposed to be 7?

15th Sep 2017, 12:16 AM
Mario Ryan Aljama
Mario Ryan Aljama - avatar
1 Réponse
+ 9
8 + y-- - -2 //prefix operators first 8 + -2-- - -2 //8 is added to y's new value of -2 before postfix 6 - -3 9
15th Sep 2017, 12:26 AM
ChaoticDawg
ChaoticDawg - avatar