Page 1 of 1

Long Long doesn't support

Posted: Tue Oct 12, 2004 7:10 pm
by TISARKER
#include<stdio.h>
void main()
{
long long a;
a=4000000000;//400 core
printf("%lld\n",a);
}

the above code does not works properly.When it is over 2147483647 then
it gives elligal result.

whats the reson.Who can help me.
Thanks.

Posted: Tue Oct 12, 2004 8:56 pm
by Krzysztof Duleba
Try a=4000000000LL;

Posted: Wed Nov 10, 2004 2:49 pm
by backslash null
Hi,
u can alsso use type cast like this:
a=(long long) 4000000000;
printf("%lld",a);

Posted: Wed Nov 10, 2004 5:14 pm
by CDiMa
backslash null wrote:Hi,
u can alsso use type cast like this:
a=(long long) 4000000000;
printf("%lld",a);
This shoudn't be done, since you are casting an integer constant to a long long variable.
Depending on the compiler this may or may not work as expected.
To be safe it's better to specify with LL that your constant is of long long type.

Ciao!!!

Claudio