为什么我得到这么大的整数?
int ans = 1 << 45;
printf("Check: %d", ans);
return 0;
查询:1858443624
最佳答案
这是 C 中的未定义行为。任何事情都可能发生,包括处理器异常或程序其他部分的不可预测的更改(这可能是积极的编译器优化的副作用)。
6.5.7/3 [...] If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined.
关于c - 当我按位移位 1 << 45 时,怎么会得到一个大整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12221819/