Type of decimal constant depends on the type in which it can be represented, per 6.4.4.1 Integer constants:
The type of an integer constant is the first of the corresponding list in which its value can be represented.
(See the table in the link for how C language says the actual type of integer constants is deduced).
Typically a signed int can't represent the value 4026658824
. So, 4026658824
probably has type long int
or long long int
on your system. If unsigned int
can be represent 4026658824
then this is fine but your compiler is being cautious.
You could use u
or U
suffix or cast it to unsigned int
. The suffix u
may not work if the integer constant has bigger value. For example, if 17179869184u
can't be represented by unsigned int
then its type may be unsigned long int
or unsigned long long int
and you may still get diagnostics about it.
unsigned int
is in range [0, 2^32-1]. – Yuriy Ivaskevych Feb 8 '17 at 13:312^32 = 4.29*10^9
. The OP is trying to store a smaller number than that,4.03*10^9
. – Lundin Feb 8 '17 at 14:212^32 - 1
, but the OP had a misconception about the range of 32 bit unsigned integers, and Yuriy pointed that out. Nothing wrong with that so long as it is a comment and not an attempt to answer the question. – StoryTeller - Unslander Monica Feb 8 '17 at 14:23