Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language uses %X to output hexadecimal numbers of type long long. When this number is negative, how to make its sign bit expansion complete with F?
C language uses %X to output hexadecimal numbers of type long long. When this number is negative, how to make its sign bit expansion complete with F?
Your compiler must support 64-bit integers.

In this example, long long is a 64-bit number.

The output can be changed to:

printf("0X%0 16LLX ",b);

Otherwise, we can only make changes:

if(b & lt; 0)printf("0XFFFFFFFF%8X ",b);

else printf("0X%0 16X ",b);