18. Integer and Floating-point Constants

Integers starting with 0 are octal (base 8).

Integers starting with 0x (or 0X) are hex (base 16).

Optional L (or l) or LL (or ll) suffix specifies long or long long.

Optional U (or u) suffix specifies unsigned.

  i = 17;   i = 021;   i = 0x11;   // equivalent statements

  i = 17L;  i = 17U;   i = 17UL;

Floating-point constants contain a decimal point or exponent or both, and are double by default.

Hex notation with a (required) binary exponent may be used. Associated printf formats are %a, %A.

Optional F (or f) suffix specifies float.

Optional L (or l) suffix specifies long double.

  d = 1.7;   d = 17e-1;  d = 0.17e1;  // equivalent statements

  d = 1.7f;  d = 1.7L;

  d = 22.0;  d = 0x16.p0;  d = 0x1.6p4; // equivalent statements, see hex.c

C17 (pdf) - 6.4.4 Constants; 6.4.5 String literals