C Character Constants

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at C Character Constants.

A "character constant" is formed by enclosing a single character from the representable character set within single quotation marks (' '). Character constants are used to represent characters in the execution character set.

character-constant:
' c-char-sequence '

L' c-char-sequence '

c-char-sequence:
c-char

c-char-sequence c-char

c-char:
Any member of the source character set except the single quotation mark ('), backslash (\), or newline character

escape-sequence

escape-sequence:
simple-escape-sequence

octal-escape-sequence

hexadecimal-escape-sequence

simple-escape-sequence: one of
\a \b \f \n \r \t \v

\' \" \\ \?

octal-escape-sequence:
\  octal-digit

\  octal-digit octal-digit

\  octal-digit octal-digit octal-digit

hexadecimal-escape-sequence:
\x  hexadecimal-digit

hexadecimal-escape-sequence hexadecimal-digit

C Constants

Show: