Range of Long long int in c++

#include <iostream>

int main ()
{ long long int n=10000000000; // 9223372036854775801

cout<<n<<endl;
return 0;
}


This code shows error message as: "integer constant too large for "long" type, but since the max range of long long int is 9223372036854775801. I'm unable to understand the reason for the error?
I'd be very happy if you help me out with this

Thanks in advance!
The maximum limit for long long int is 9223372036854775807 and not 9223372036854775801, sorry for that, but that still doesn't explain the error message. :/
Your code displays the correct number for me, what compiler are you using? Try doing n = 10000000000LL;
Last edited on
It works now, What does that LL in the end signify? When it should be used in a code?

PS: I'm using Dev C++ 4.9.9.2, which one are you using?
Last edited on
What does that LL in the end signify?

see tutorial page: http://www.cplusplus.com/doc/tutorial/constants/



Please don't use Dev C++ 4.9.9.2. it was last updated in 2005 and is no longer updated.

Consider instead:
http://www.codeblocks.org/
or
http://orwelldevcpp.blogspot.com/

Thanks a lot! :)
Ok, So I downloaded the latest Dev Cpp compiler, But I am facing the following error while compiling the code:

http://i60.tinypic.com/2ilbvh4.jpg ( Click on the image in the middle )

Please help!
No, It is fixed now.
Topic archived. No new replies allowed.