In C90, the type of an unsuffixed decimal integer constant (literal) is the first of
int
long int
unsigned long int
that can represent its value without overflow.
In C99 and later, it's the first of
int
long int
long long int
that can represent its value.
The value 4014109449
happens to be representable as a 32-bit unsigned integer, but not as a 32-bit signed integer. Assuming your system has 32-bit long
s, that constant's type is unsigned long int
in C90, long long int
in C99 and C11.
That's what the warning is telling you. The type of the constant changes depending on which version of the C standard your compiler conforms to.
Note that, regardless of its type, the value of 4014109449
will always be correct, and in your declaration:
long long int num = 1000000000000;
that value will always be correctly converted to long long
. But it certainly wouldn't hurt (and would silence the warning) to add a LL
suffix to make it explicit that you want a value of type long long
:
long long int num = 1000000000000LL;
As for this:
long long int num = 1000000*1000000;
assuming you have 32-bit int
s, the constant 1000000
is of type int
, and the result of multiplying two int
values is also of type int
. In this case, the multiplication will overflow. Again, you can avoid the problem by ensuring that the constants are of type long long int
:
long long int num = 1000000LL * 1000000LL;
(Note that you can use lowercase ll
, but it's a bad idea, since it can be difficult to distinguish the letter l
from the digit 1
.)