BACK
Appendix A
The ASCII Code
Each character is stored as its ASCII Code, which is an integer in the range 0 to 127. Note that the first 32 characters are nonprinting characters, so their symbols in the first column are indicated either with their control sequence or with their escape sequence. The control sequence of a nonprinting character is the combination of Control key and another key that is pressed on the keyboard to enter the character. For example, the end-of-j& character (ASCII code 4) is entered with the Ctrl-D sequence. The escape sequence of a nonprinting character is the combination of the backslash character \ (called the control character) and a letter that is typed in C++ source code to indicate the character. For example, the newline character (ASCII code 10) is written \n in a C++ program.
1. ASCII is an acronym for the American Standard Code for Information
Interchange
405
406
THE ASCII CODE
[APP. A
Character
Ctrl-W Ctrl-X Ctrl-Y Ctrl-Z Cancel
Description
End transmission block
Decimal
23 24 25 26
Octal
027 030 031 032
Hex
0x17 0x18 0x19 Oxla
Binary
0001 0001 0001 0001 0111 1000 1001 1010
End of message, interrupt Substitute, exit
# $ %
&
Hash mark, number sign Dollar sign Percent sign Ampersand Apostrophe, single quote 36 37 38 39 40 41 42 43 44 45 46 47 48 044 045 046 047 050 051 052 053 054 055 056 057 060 0x24 0x25 0x26 0x27 0x28 0x29 Ox2a Ox2b ox2c Ox2d Ox2e Ox2f 0x30 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0000
( ) * + I -
Left parenthesis Right parenthesis Asterisk, star, times Plus Comma Dash, minus Dot, period, decimal point
/ 0
Slash Digit zero
; < = >
Semicolon Less than Equal to Greater than
59 60 61 62
073 074 075 076
0x3s ox3c Ox3d Ox3e
0011 0011 0011 0011
1011 1100 1101 1110
THE ASCII CODE
407
408
THE ASCII CODE
[APP. A
Tilde Delete Delete, rub out
126 127
0176 0177
Ox7e Ox7f
0111 0111
1110 1111