mikroC

mikroC - C Compiler for Microchip PIC microcontrollers

making it simple...

Character Constants

A character constant is one or more characters enclosed in single quotes, such as 'A', '+', or '\n'. In C, single-character constants have data type int. Multi- 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 common 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, '\x3F' for the question mark. You can use any string of up to three octal or any number of hexadecimal 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 \777 is larger than the maximum value allowed

(\377) and will generate an error. The first nonoctal or nonhexadecimal character 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 system paths.

page

 

42

MikroElektronika: Development tools - Books - Compilers