"ack_code" is assigned (and tested against) negative numbers, but was declared as "char". Which only works if "char" is signed - which it necessarily isn't. So make that signedness assumption specific.