What is the output of: byte b = 255; b++; Console.WriteLine(b);?
Correct answer A. 0
Explanation
The increment operator on a byte performs the addition and converts back to byte implicitly. In the default unchecked context, 256 does not fit in 0 to 255, so the value wraps to 0. Note that b = b + 1; would not compile without a cast, because b + 1 is an int, but b++ and b += 1 include the conversion automatically.
Answer checked How we write and check questions
Discussion