如何初始化unsigned long long类型?

时间:2022-10-15 16:44:16

I'm trying to initialize an unsigned long long int type. But the compiler is throwing an error

我正在尝试初始化unsigned long long int类型。但编译器抛出错误

"error: integer constant is too large for "long" type ".

“错误:整数常量对于”long“类型来说太大了”。

The initialization is shown below :

初始化如下所示:

unsigned long long temp = 1298307964911120440;

Can anybody please let me know what the problem is and suggest a solution for the same.

任何人都可以让我知道问题是什么,并提出相同的解决方案。

3 个解决方案

#1


20  

Try suffixing your literal value with ULL

尝试使用ULL为您的文字值添加后缀

#2


11  

First, be sure your compiler supports the long long type. Second, add a "ULL" suffix to the number.

首先,确保您的编译器支持long long类型。其次,为数字添加“ULL”后缀。

#3


5  

Q: How to initialize an unsigned long long type?

问:如何初始化unsigned long long类型?

A: With an unsigned long long constant!

答:使用无符号长长常数!

(Add suffix ULL to the constant.)

(将后缀ULL添加到常量。)

#1


20  

Try suffixing your literal value with ULL

尝试使用ULL为您的文字值添加后缀

#2


11  

First, be sure your compiler supports the long long type. Second, add a "ULL" suffix to the number.

首先,确保您的编译器支持long long类型。其次,为数字添加“ULL”后缀。

#3


5  

Q: How to initialize an unsigned long long type?

问:如何初始化unsigned long long类型?

A: With an unsigned long long constant!

答:使用无符号长长常数!

(Add suffix ULL to the constant.)

(将后缀ULL添加到常量。)