|
|
|
|
|
|
|
2. One of the following escape sequences, enclosed by apostrophes: |
|
|
|
|
| |
|
|
|
|
Newline (Line feed in ASCII) |
|
|
|
| | | | | | | | | | | | | | | | |
|
|
|
|
Single quote (apostrophe) |
|
|
|
| | |
|
|
|
|
Double quote (quotation mark) |
|
|
|
| | |
|
|
|
|
Null character (all zero bits) |
|
|
|
| | |
|
|
|
|
Octal equivalent (1, 2, or 3 octal digits specifying the integer value of the desired character) |
|
|
|
| | |
|
|
|
|
Hexadecimal equivalent (1 or more hexadecimal digits specifying the integer value of the desired character) |
|
|
|
|
|
|
|
|
|
|
Even though an escape sequence consists of two or more characters, each escape sequence represents a single character in the character set. The alert character (\a) is the same as what is called the BEL character in ASCII and EBCDIC. To ring the bell (well, these days, beep the beeper) on your computer or terminal, you can output the alert character like this: |
|
|
|
|
|
|
|
|
In the list of escape sequences above, the entries labeled Octal equivalentand Hexadecimal equivalent let you refer to any character in your machine's character set by specifying its integer value in either octal or hexadecimal form. |
|
|
|
|
|
|
|
|
Note that you can use an escape sequence within a string just as you can use any printable character within a string. The statement |
|
|
|
|
|
|
|
|
beeps the beeper, displays Whoops!, and terminates the output line. The statement |
|
|
|
|
|
|
|
|
outputs She said Hi and does not terminate the output line. |
|
|
|
|
|