User`s manual

Dynamic C Users Manual digi.com 31
4.7.2 Character Constants
Character constants have a slightly different meaning. They are not strings. A character constant is
enclosed in single quotes (
' ') and is a representation of an 8-bit integer value.
'a' '\n' '\x1B'
Any character can be represented by an alternate form, whether in a character constant or in a string. Thus,
nonprinting characters and characters that cannot be typed may be used.
A character can be written using its numeric value preceded by a backslash.
There are also several “special” forms preceded by a backslash.
Examples
\x41 // the hex value 41
\101 // the octal value 101, a leading zero is optional
\B10000001 // the binary value 10000001
\a bell
\f formfeed
\r carriage return
\v vertical tab
\\ backslash
\’ single quote
\b backspace
\n newline
\t tab
\0 null character
\c the actual character c
\” double quote
"He said \"Hello.\"" // embedded double quotes
const char j = 'Z'; // character constant
const char* MSG = "Put your disk in the A drive.\n";
// embedded new line at end
printf( MSG ); // print MSG
char* default = ""; // empty string: a single null byte