Question.3
A developer computes the midpoint of two uint8_t ADC readings:
uint8_t
uint8_t a = 250, b = 10; uint8_t mid = (a + b) / 2; printf("%u", mid);
What is the output?
Select Answer
130 — correct midpoint
2 — (a+b) wraps to 4 in uint8_t, then 4/2 = 2
130 — integer promotion to int prevents wraparound
Undefined behavior — unsigned overflow in intermediate calculation