All the escape characters and their corresponding meanings:
Escape character |
Significance |
ASCII code value (decimal) |
\a |
Bell (BEL) |
007 |
\b |
BACKSPACE (BS) to move the current position to the previous column |
008 |
\f |
Page Break (FF), moving the current position to the beginning of the next page |
012 |
\ n |
Line Break (LF), move the current position to the beginning of the next line |
010 |
\ r |
Enter (CR) to move the current position to the beginning of the bank |
013 |
\ t |
Horizontal tab (HT) (jumps to the next tab position) |
009 |
\v |
Vertical tabulation (VT) |
011 |
\\ |
Represents a backslash character ' \ ' |
092 |
|
|
|
\‘ |
Represents a single quotation mark (apostrophe) character |
039 |
\" |
Represents a double-quote character |
034 |
/ |
Null character (NULL) |
000 |
\ddd |
Any character represented by a 1 to 3-bit octal number |
Three-bit octal |
\xhh |
Any character represented by 1 to 2 hexadecimal digits |
Two-bit hexadecimal |
Note: Differentiate, Slash: "/" with backslash: "\", not interchangeable here
Character-type constants
The value represented by a character constant is the value that a character variable can contain. We can use an ASCII expression to represent a character constant, or an escape character with a backslash in single quotation marks.
' A ', ' \x2f ', ' \013 ';
Where: \x indicates that the following character is a hexadecimal number, and that the following character is an octal number.
Note: In Turbo C 2.0, the number of character constant representations ranges from 128 to 127 unless you declare it as unsigned, which is 0 to 255.
The \x,\n,\a we see above are called escape characters, which tells the compiler that it needs to be handled in a special way.
C # escape character (Z)