A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-45.c
1#include<stdio.h>
2intmain(void){
3unsignedcharx=200;
4unsignedchary=100;
5unsignedcharz=x+y;
6printf("%d\n",z);
7return0;
8}
Conversions
Answer & explanation
Console output
44
Why
The operands are promoted to int, so x + y is computed exactly as 300. Assigning that back into the unsigned char z reduces it modulo 256, giving 44. The intermediate arithmetic does not overflow; only the final narrowing conversion wraps, and it does so in a well-defined way.