As you learnt from your previous question, char
is signed on your platform. Therefore, at the beginning of your while
loop, c
has a negative value.
Right-shifting a negative value is implementation-defined. On your platform, I imagine it is doing an arithmetic shift.
4
solved Bitwise OR not working C [duplicate]