If a would be declared with the type unsigned, by shifting to the right the same result will be obtained, because the value of a is positive (the sign bit is 0). The value of b is negative (the 15th bit – the sign bit – is 1), by shifting to the right the sign propagates, so it will fill with 1.