“得到long long int”是PTED为“长整型”间$ P $。我如何克服这个? [英] 'long long int' is interpreted as 'long int'. How do I get round this?
问题描述
我的工作涉及C编程在我大学的数学课程项目。
我需要能够处理大的整数,比那些可以存储在一个长整型数据类型大。所以我试图用'得到long long int',但如果我尝试这样的事:
I'm working on project involving c programming for my mathematics course at university. I need to be able to handle large integers, larger than those that can be stored in a 'long int' datatype. So I tried using 'long long int', but if I try something like this:
long long int number;
number = 10000000000;
然后,错误消息指出的的错误:整型常量太大长类型的
我试过其它数据类型,如___int64'和'int_64t我试过,包括所有的标准C库和我仍然得到了同样的问题。
I've tried other datatypes like '___int64' and 'int_64t' I've tried including all the standard c libraries and I still get the same problem.
奇怪的是,当我尝试'的printf(LLONG_MAX =%LLD \\ n,LLONG_MAX);
,我得到这样的:
Strangely, when I try 'printf("LLONG_MAX = %lld\n", LLONG_MAX);'
, I get this:
LLONG_MAX = -1
我使用的是Windows XP上的$ C $ 8.02的cblock,但我不知道,因为我使用的是校园网的计算机安装的是什么版本的GCC编译器,我没有权限访问该文件系统的主。我不希望有把我的笔记本电脑进入校园的每一天。请帮忙!谢谢
I'm using Codeblocks 8.02 on windows xp, but I'm not sure what version of gcc compiler is installed since I'm using network computers on campus and I don't have permission to access the main filesystem. I don't want to have to bring my laptop into campus everyday. Please help! Thanks
推荐答案
在微软环境下用printf这个语法:结果
In Microsoft environment use printf with this syntax :
__int64 i64 = 10000000000;
unsigned __int64 u64 = 10000000000000000000;
printf ( "%I64d\n", i64 );
printf ( "%I64u\n", u64 );
printf ( "%I64d\n", u64 ); <-- note this typo
这篇关于“得到long long int”是PTED为“长整型”间$ P $。我如何克服这个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!