我对这段代码感到困惑:
#include <climits>
#include <iostream>
int main(void) {
using namespace std;
cout << "long max " << LONG_MAX << endl;
long x = 2 * 1024 * 1024 * 1024;
cout << "2 * 1024 * 1024 * 1024 = " << x << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我本来应该是2147483648,而不是我.使用unsigned似乎没有帮助.是什么赋予了?
long max 9223372036854775807
2 * 1024 * 1024 * 1024 = -2147483648
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
399 次 |
| 最近记录: |