Previous: Strings, Up: Characters [Contents][Index]
A single character may be written as a single quote immediately followed by
that character. Some backslash escapes apply to characters, \b
,
\f
, \n
, \r
, \t
, and \"
with the same meaning
as for strings, plus \'
for a single quote. So if you want to write the
character backslash, you must write '\\ where the first \
escapes
the second \
. As you can see, the quote is an acute accent, not a grave
accent. A newline
immediately following an acute accent is taken as a literal character
and does not count as the end of a statement. The value of a character
constant in a numeric expression is the machine’s byte-wide code for
that character. as
assumes your character code is ASCII:
'A means 65, 'B means 66, and so on.