liveBook · Manning

Numeric character constant

As explained in Modern C

A numeric character constant is a C character constant whose character code is written using octal or hexadecimal escape notation.

A numeric character constant writes a C character code with octal or hexadecimal escape notation. Its interpretation depends on the execution character set, so the resulting character is not fully portable. section 8.4

Hexadecimal escape boundaries

The string "\xdeBruyn" does not mean the character \xde followed by "Bruyn". The hexadecimal escape consumes the following hex digit B, producing the character with code 3563, followed by "ruyn". Write "\xde" "Bruyn" when the intended boundary must be explicit; consecutive string literals are concatenated. section 8.4

TAKEAWAY

  • Treat numerically encoded characters as execution-environment dependent: whether code 3563 exists and which character it denotes depends on the platform and execution settings. section 8.4
  • Avoid these constants when portability matters; compilation across platforms does not guarantee the same character or even its existence. section 8.4

How Modern C covers it

How deep it goes
Explains escape consumption and portability consequences, but stops short of detailing character-set representations.
Examples
Uses "\xdeBruyn" and adjacent literals "\xde" "Bruyn" to expose hexadecimal escape boundaries.
What you can do after
Evaluate whether numerically encoded characters are safe to use across execution environments.
How it connects
Connects character constants with string literals, escape sequences, and the execution character set.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern C. The section links point to the parts of the book it draws on.