[英]unexpected behaviour from conversion from long long to int
I'm working on VS2019, in windows 10 64bit.我正在使用 windows 10 64 位的 VS2019。 I was doing some try and I tried the following code
我正在做一些尝试,我尝试了以下代码
int main() {
unsigned long long ull = 70000;
unsigned int ui = ull;
std::cout << ui;
}
I would expect to get an output different from 70000, because 70000 is bigger then then the biggest number that an int variable can store.我希望得到一个不同于 70000 的 output,因为 70000 大于 int 变量可以存储的最大数字。 so why do I get
70000
as output?那么为什么我得到
70000
作为 output? how is that possible?这怎么可能?
A 32 bit unsigned int can store values from 0 to 4,294,967,295. 32 位无符号整数可以存储从 0 到 4,294,967,295 的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.