+ 4

(int)-4294967295 == 1, How?

#include <iostream> using namespace std; int main() { cout << (int)4294967295 << endl; cout << (int)-4294967295 << endl; return 0; } /* Output: -1 1 How (int)-4294967295 is equal to 1 and (int)4294967295 is equal to -1 */

13th Jul 2019, 11:51 PM
blACk sh4d0w
blACk sh4d0w - avatar
2 Réponses
+ 3
ChillPill 4294967295 == - 1. So it means -4294967295 == 1 is because the signs get multiplied (- * -1) and it becomes 1, is that right?
14th Jul 2019, 5:10 AM
blACk sh4d0w
blACk sh4d0w - avatar