char
literals are defined by wrapping the value with single-quotes '
:
char c = 'h';
Character literals may contain escape sequences. See String Escape Sequences
A character literal must be exactly one character long (after all escape sequences have been evaluated). Empty character literals are not valid. The default character (returned by default(char)
or new char()
) is '\0'
, or the NULL character (not to be confused with the null
literal and null references).