改成 max=9223372036854775807LL; 这样就不会有警告了。
这样这个数据在未赋值前就被认为是long long型的 (后面跟有LL)
#include<iostream>
using namespace std;
int main(){
unsigned long long i = 0;
printf("long long type is %d bytes\n",sizeof(i));
printf("取值范围 0 ~ %I64u\n",i-1); //windows 下用I64u,linux下用llu
i = 9223372036854775807LL;
printf("%I64u\n",i);
system("pause");
return 0;
}
长整型常量一般后面加LL,否则默认为int 类型,就会出现 too large for inteager 的错误