unsigned int x =-1;
Can we assign unsigned int with a negative integer的位表示形式是什么?
#include<stdio.h>
int main(){
unsigned int x = -1;
int y = ~0;
if(x == y)
printf("same");
else
printf("not same");
return 0;
}
输出 :
相同的
怎么可能,x 是无符号的
#include<stdio.h>
int main()
{
unsigned int x = -4;
if (x == -4)
printf("true");
else
printf("FALSE");
}
输出:
真的