#include <iostream>
#include <stdio.h>
int main() {
unsigned int p = -1;
printf("%d\n",p);
std::cout << p <<std::endl;
return 0;
}
ubuntu下编译执行
-1
4294967295
c++里面,负数会被解释为位模式,-1的位模式为:
0xFFFF
#include <iostream>
#include <stdio.h>
int main() {
unsigned int p = -1;
printf("%d\n",p);
std::cout << p <<std::endl;
return 0;
}