Question.4
A developer uses right shift to divide a signed ADC offset by 2:
int8_t offset = -4; int8_t halved = offset >> 1; printf("%d", halved);
What does the C standard guarantee about the result?
Select Answer
-2 — arithmetic shift preserves the sign
126 — logical shift fills with 0, making the result positive
Implementation-defined — the standard doesn't specify whether the shift is arithmetic or logical
Undefined behavior — right shift of negative values is not allowed