C numeric constants can be any of the following:
Decimal integer constants (base 10) consist of one or more digits, 0 through 9, where 0 cannot be used as the first digit.
Binary constants (base 2) begin with a 0b or 0B prefix, followed by one or more binary digits (0, 1).
Octal constants (base 8) consist of one or more digits 0 through 7, where the first digit is 0.
Hexadecimal constants (base 16) begin with a 0x or 0X prefix, followed by a hexadecimal number represented by a combination of digits 0 through 9, and characters A through F.
Floating-point constants consist of:
— an optional sign - or +
— an integer part a combination of digits 0 through 9
— a period .
— a fractional part a sequence of digits 0 through 9
— an optional exponent e or E, followed by an optionally signed sequence of one or more digits
For example, the following floating-point constant contains both the optional and required parts: +1.15e-12.
The following floating-point constant contains only the required parts: 1.0
The following formal grammar summarizes the rules for the C numeric constants:
C-constant: |