Matthew L.

asked • 11/03/21

Why is signed char 0xff = -1?

I don't understand it very well.

Lu S.

This implies that it is coded in 2's complement. the leading 1 means it is negative. To convert it to positive, you invert all the bits ~0xff = 0x0, then add 1. So the number is -1 in 2's complement form.
Report

12/22/21

1 Expert Answer

By:

Nathan S. answered • 11/04/21

Tutor
4.9 (20)

Former Mainframe Applications Developer

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.