Possible Duplicate:
How do I write a short literal in C++?
I can use ll
to represent a long long number, I can use u
to represent a unsigned number, etc.
Is there a number suffix for short
type?
so no, there is no suffix for shorts.
For example, // small integer short a = 12345; Here, a is a short integer variable. Note: short is equivalent to short int .
Unsigned constants are written with a terminal u or U , and the suffix ul or UL indicates unsigned long . Floating-point constants contain a decimal point ( 123.4 ) or an exponent ( 1e-2 ) or both; their type is double , unless suffixed.
The C++ standard only gives these integer suffixes (2.13.1)
unsigned-suffix: one of
u U
long-suffix: one of
l L
long-long-suffix: one of
ll LL
so no, there is no suffix for shorts.
No there is no integer constant suffix for short
in C.
In most expressions a short
value is promoted to int
so it is not so useful. You can cast an int
integer constant to short
, but with the integer promotions rules, chances are it will be promoted to int
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With