Types
35
The smallest allowed type that still fits the integer literal is the resulting
type. This means that among all types allowed for a particular integer, the
smallest type will apply. For example,
the integer literal
112114
could be an
int
, a
long
, or a
long long
. Since an
int
can store 112114, the resulting integer
literal is an
int
. If you really want, say, a
long
, you can instead specify
112114L
(or
112114l
).
Dostları ilə paylaş: