int x = -2147483648
来源:互联网 发布:淘宝产品文案类型 编辑:程序博客网 时间:2024/06/05 17:16
直接写 int x = -2147483648 在vs 2013 里会报错,因为在编译的时候, -2147483648 当做一个表达式, 用一个int 型的2147483648 当做中间变量, 然而,int型的2147483648 超出了范围,所以编译器把它转化为unsigned int类型,然后前面又有一个负号,所以报错:
错误 10 error C4146: 一元负运算符应用于无符号类型,结果仍为无符号类型
正确的方式有一下两种:
1:
int n = -2147483647 - 1;
2:
int n = INT_MIN;
阅读全文
0 0
- int x = -2147483648
- int sqrt(int x)
- y=x++ + ++x(int x=0)的结果?
- _sys_exit( int x) { x = x; } 报错
- ios 随机数 int x = arc4random() % 100;
- Implement int sqrt(int x).
- A(A& other,int x=0)//*/ A(const A& other,int x=0)
- 原码、反码、补码:int x=1;int y=~x;
- c语言大神进 int x=-11; printf(x=%x",x); 答案是fffffff6
- int *x, y; int* x, y;
- isspace(int x)
- isdigit(int x)
- 【leetcode】sqrt(int x)
- typeof(int [3]) x;
- const int *x 和 int * const x, const int& x和 int const &x的区别
- for(int& x:first)
- 枚举,int ... X,ScheduledExecutorService
- int main() { int *pa=NULL; int *pb=pa+15; printf("%x",pb); return 0; } -- C
- Gym 101246DFire in the Country (dfs暴力博弈)
- Unity脚本事件执行的顺序
- Shell第一天
- 使用PHP操作mysql和mysqli与PDO的区别
- 九度oj-1064-反序数
- int x = -2147483648
- 存储过程
- JavaWeb学习总结(二)——Tomcat服务器学习和使用(一)
- OpenCV学习笔记——Mat,图像的新容器
- Linux 中 eval命令的作用
- 分治法-归并排序
- 非平稳时间序列综合分析
- ML-Regression
- Hive的三种Join方式