Why making an int -2147483648 to positive overflow int.
int x = -2147483648; int num; if(x<0) { num = -x; //overflow here }
For ex:below both x and y are same.
int x = -2147483648; cout<<x<<endl; int y = -x; cout<<x<<endl; Output: -2147483648 -2147483648
2.1m questions
2.1m answers
60 comments
57.0k users