Escape sequences
Escape sequences are used to define certain special characters within string literals.
The following escape sequences are available:
Escape sequence | Description | Representation |
---|---|---|
\' | single quote | byte 0x27 |
\" | double quote | byte 0x22 |
\? | question mark | byte 0x3f |
\\ | backslash | byte 0x5c |
\0 | null character | byte 0x00 |
\a | audible bell | byte 0x07 |
\b | backspace | byte 0x08 |
\f | form feed - new page | byte 0x0c |
\n | line feed - new line | byte 0x0a |
\r | carriage return | byte 0x0d |
\t | horizontal tab | byte 0x09 |
\v | vertical tab | byte 0x0b |
\nnn | arbitrary octal value | byte nnn |
\xnn | arbitrary hexadecimal value | byte nn |
\unnnn | arbitrary Unicode value. May result in several characters. | code point U+nnnn |
\Unnnnnnnn | arbitrary Unicode value. May result in several characters. | code point U+nnnnnnnn |
Example
#include <iostream> void main() { cout<<"aaa"<<"\n"<<"bbb";
getch();
}
Output:
aaa bbb