看一道题目
#include <iostream>
using namespace std;
int main()
{
unsigned char a = 0xA5;
//printf("a=%d\n",a);
//printf("~a=%d\n",~a);
unsigned char b = ~a>>4;
printf("%d\n",b);
//return 0;
}
其结果为245.
查看监视,可分析得245为截断值
看一道题目
#include <iostream>
using namespace std;
int main()
{
unsigned char a = 0xA5;
//printf("a=%d\n",a);
//printf("~a=%d\n",~a);
unsigned char b = ~a>>4;
printf("%d\n",b);
//return 0;
}
其结果为245.
查看监视,可分析得245为截断值