We are using the unsigned type conversions. This does not mean that we can't convert a negative number. You may be surprised by the output of the following code:
printf( " Negative Numbers as Unsigned:\n" );
printf( " -0 [%12o] [%12u] [%12x] [%12X]\n" ,
-0 , -0 , -0 , -0 );
printf( " -1 [%12o] [%12u] [%12x] [%12X]\n" ,
-1 , -1 , -1 , -1 );
printf( " -2 [%12o] [%12u] [%12x] [%12X]\n" ,
-2 , -2 , -2 , -2 );
printf( " -12 [%12o] [%12u] [%12x] [%12X]\n\n" ,
negativeInt , negativeInt , negativeInt , negativeInt );
Negative numbers are treated specially by every computer system; they are converted internally using an algorithm called two's complement. Two's complement is a method to avoid the problem of having +0 and -0, which is why the second statement in this code snippet uses -0 as a value to test how it is treated....