#include
ooh hand trace practice. so you weren't supposed to do what I just did :-P lets initialize the stuff \[num1 = 8\] \[num2 = 6\] \[trash = -4\] this one gets a little tricky, but if you are absolutely unsure, refer to the white book pages 52 to 53. And lo! *, /, and % all have the same precedence, and are left to right associative. *, %, and / have higher precedence that subtraction. I translated it to parens in the following expression: \[result = (4*num1) - ((26/num2)mod3)\] \[result = 32 - 1 = 31\] the prefix -- decrement operator decreases the value of num2 before the rest of the expression is calculated. \[num2 = 5\] num1 uses the same old value of num 1, which is 8 \[sum = 8 + 5 = 13\] the postfix ++ increment operator increments num1 after sum is assigned a value. \[num1 = 9\] the next one is straightforward \[trash = trash - (13 + 31) = -4 -44 = -48\] Therefore, you should get something like \[num1 = 9, num2 = 5, sum = 13, result = 31, trash = -48\]
Join our real-time social learning platform and learn together with your friends!