It depends on the platform but a signed integer is from -2^31 to 2^31
Still Need Help?
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (anonymous):
This is the first time I've encountered something like this though so I am not even sure if I am doing it right typing any data type that is more than 1 word.
OpenStudy (anonymous):
A long signed integer is from -2^63 to 2^63
OpenStudy (anonymous):
*long long
OpenStudy (anonymous):
one second.
OpenStudy (anonymous):
I am using dev c++
Still Need Help?
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (anonymous):
Also you forgot to initialize the variable to 0
OpenStudy (anonymous):
So it will simply take on the value that was there before it on the stack.
OpenStudy (anonymous):
long long int n = 0;
OpenStudy (anonymous):
Ok
OpenStudy (anonymous):
Same error
Still Need Help?
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (anonymous):
"integer constant is too large for "long" type"
OpenStudy (anonymous):
Don't need int
just long long
OpenStudy (anonymous):
long long n = 0;
OpenStudy (anonymous):
Fine now?
OpenStudy (anonymous):
No, same error
Still Need Help?
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (anonymous):
Hmm
OpenStudy (anonymous):
ah ok
I think I know what will help
Its complaining about the literal
try adding an l after the number or ll
OpenStudy (anonymous):
600851475143ll I think
OpenStudy (anonymous):
That did it
OpenStudy (anonymous):
Cool, what does that mean?
Still Need Help?
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (anonymous):
its a long long literal
OpenStudy (anonymous):
Anytime you have long or long long you need l or ll?
OpenStudy (anonymous):
l is just long, ll is long long
OpenStudy (anonymous):
Im sure you've seen something similar for floating point values
OpenStudy (anonymous):
for instance 3.0f
Still Need Help?
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (anonymous):
never
OpenStudy (anonymous):
alright
OpenStudy (anonymous):
in any case be very careful with your types if you are going to be handling long long values
OpenStudy (anonymous):
you don't want to truncate it at some point in the program
OpenStudy (anonymous):
Ok, thanks a lot!
Still Need Help?
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (anonymous):
Actually one last thing, long is the implicit type for integer literals (at least for your compiler). So you only need ll for long long literals, for smaller values you do not need to explicitly append a single "l"