Loading, please wait...

Number Constants

Number constants are assumed to be signed decimal integers. eg. 42

But if they:

  1. start with a zero, the number is an unsigned octal integer. eg. 0456
  2. start with 0x or 0X, the number is an unsigned hexadecimal integer.
  3. 0xA7f, 0Xabc
  4. are too big to fit into a signed integer (or an unsigned integer if octal or hexadecimal) then the constant type is a signed long integer (or an unsigned long integer if octal or hexadecimal).
  5. have an L or l suffix, the number is a signed long integer. eg. 42L, 99l
  6. have a U or u suffix, the number is an unsigned integer. eg. 42U, 99u
  7. have both a U and an L suffix (or u and l), the number is an unsigned long integer. eg. 42UL, 99ul
  8. contain a decimal point or scientific 'e' notation, the number is of type double. eg. 7.3, 42e-1, 12.34E+4
  9. contain a decimal point or scientific 'e' notation and an F or f suffix the number is of type float eg. 7.3F, 42e-1f
  10. contain a decimal point or scientific 'e' notation and an L or l suffix the number is of type long float eg. 7.3L, 42e-1