i’m using c++, even if i declare long int, there is error like……
long int num = 600851475143;
warning: integer constant is too large for ‘long’ type
which datatype should be used in this case?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A lot of it depends on the platform and compiler you are using.
If you are on a x64 platform, a long datatype in C++ should work.
A signed long ranges from −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807. An unsigned long on the other hand ranges from 0 to +18,446,744,073,709,551,615.
Also depending on the compiler and platform there are a few other datatypes which effectively is the same thing (doubleword, longword, long long, quad, quadword, int64).
C (not C++) supports the long long data type. Say if you are on Fedora 10 x32 then gcc 4.3.0 supports the long long datatype but you must put the LL after the large literal. See
http://www.daniweb.com/forums/thread162930-2.html