当我使用gcc版本6.3.0编译我的代码时,结果为151。当我编译它时,唯一的变化是使用12288代替34455,它给出的结果不正确为零。
#include <stdio.h>
#include <math.h>
int main()
{
int test = 0;
int a = 34455;//12288;
int b = 0xff;
a = a&b;
printf("press any key to continue%d\n", a);
getchar();
return 0;
}
答案 0 :(得分:6)
0
是正确的结果。 12288
是0x30000
。所以:
30000
& 000ff
-----
00000