I read somewhere that default floating point values like 1.2
are double
not float
.
So what are default integer values like 6
-
There are three types of integer literals(or integer constants in the standards terminology): decimal, octal or hex and the rule are slightly different for your specific example 6
would be int
but in general for decimal constants without a suffix(u, U, l, L, ll, LL) it will be based on which type can represent the value which is covered in the draft C99 standard section 6.4.4.1
Integer constants paragraph 5 which says:
The type of an integer literal is the first of the corresponding list in which its value can be represented.
so for a decimal literal without a suffix the types would be the first of:
- int
- long int
- long long int
and for octal and hex the types would be the first of:
- int
- unsigned int
- long int
- unsigned long int
- long long int
- unsigned long long int
- 热议问题