#include
void main()
{
int a,b;
a=234;
b=~a;
printf("\40: The a's l complement(decimal)(十进制) is %d \n",b);
a=~a;
printf("\40: The a's l complement(hexidecimal)(十六进制) is %d \n",a);
}
为什么两次输出都是-235啊
%d是十进制格式,%x是十六进制格式。
你好,输出16进制用%x
你好,你的输出十六进制用的 %d ,你换成 %x 就可以了!