mikroC
making it simple...
mikroC - C Compiler for Microchip PIC microcontrollers
Character Constants
A character constant is one or more characters enclosed in single quotes, such as
,
, or
. In C, single-character constants have data type
. Multi-
'A'
'+'
'\n'
int
character constants are referred to as string constants or string literals. For more
information refer to String Constants.
Escape Sequences
The backslash character (
) is used to introduce an escape sequence, which allows
\
the visual representation of certain nongraphic characters. One of the most com-
mon escape constants is the newline character (
).
\n
A backslash is used with octal or hexadecimal numbers to represent the ASCII
symbol or control code corresponding to that value; for example,
for the
'\x3F'
question mark. You can use any string of up to three octal or any number of hexa-
decimal numbers in an escape sequence, provided that the value is within legal
range for data type char (0 to 0xFF for mikroC). Larger numbers will generate the
compiler error "Numeric constant too large".
For example, the octal number
is larger than the maximum value allowed
\777
(
) and will generate an error. The first nonoctal or nonhexadecimal character
\377
encountered in an octal or hexadecimal escape sequence marks the end of the
sequence.
Note: You must use
to represent an ASCII backslash, as used in operating sys-
\\
tem paths.
page
42
MikroElektronika: Development tools - Books - Compilers
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?