What is the output of this code?
int a = 4; int b = 6; b = a++; Console.WriteLine(++b); I know that the answer is 5 (from trial and error), I just don't understand the logic behind the resolution. When I see this code I see: 6 = a++ (5 because the increment of 4 is 5) Whatever algebra I learned years ago goes straight down the drain. Does b = 6 essentially get overwritten because it's not set as a constant? I also don't understand the relevance of the prefix/postfix ++ in this scenario. Is the purpose of post/prefix similar to that of PEDMAS? Prefix means to increment before the equation, and postfix means to increment after the equation right? So if I'm getting this right: a=4, b=6, x=? a++*b = 25 (4*6+1) ++a*b = 30 ((4+1)*6) That doesn't seem to be the case, but that's where my brain has led me.