Much like variables, literals may be qualified to force the compiler to treat them as a specific data type.
Qualifiers are specified by adding a suffix to the value:
- U or u for unsigned: 25u
- L (preferred) or l for long: 25L
- F or f for float: 10f or 10.25f
The U and L suffixes may be combined to create an unsigned long literal: 0xF5UL, but U must always precede L.
Why Are Qualifiers Needed?
Also, a number like 10 will be interpreted as an integer. However, in some arithmetic expressions it may be necessary to force the compiler to treat it as a floating-point value to get the desired result.