CS255 Syllabus

Representing alphanumerical data

• Alphanumerical (or "textual") information is also represented using a code within the computer

(Recall that the 2's complement representation was a code)

• In the beginning of the computer history, different computer manufacturers would use different codes to represent the same character

(Meaning: in one computer, 00000001 can mean 'A" while in another 00000001 would mean 'X')

Obviously, this is a nightware when you want to exchange data:

Original text        Representation      Representation       Received as
in computer A       in computer B

'A'                  00000001   ------->   00000001              'X'

The text would become scrambled....

• In order to interchange information between computers, all computers must use the same code

The most popular code for representing the English alphabet is the ASCII code

ASCII = American Standard Code of Information Interchange

The American Standard Code of Information Interchange
• The ASCII encoding scheme in decimal:
0 NUL   1 SOH    2 STX    3 ETX    4 EOT    5 ENQ    6 ACK    7 BEL
8 BS    9 HT    10 NL    11 VT    12 NP    13 CR    14 SO    15 SI
16 DLE  17 DC1   18 DC2   19 DC3   20 DC4   21 NAK   22 SYN   23 ETB
24 CAN  25 EM    26 SUB   27 ESC   28 FS    29 GS    30 RS    31 US
32 SP   33 !     34 "     35 #     36 \$     37 %     38 &     39 '
40 (    41 )     42 *     43 +     44 ,     45 -     46 .     47 /
48 0    49 1     50 2     51 3     52 4     53 5     54 6     55 7
56 8    57 9     58 :     59 ;     60 <     61 =     62 >     63 ?
64 @    65 A     66 B     67 C     68 D     69 E     70 F     71 G
72 H    73 I     74 J     75 K     76 L     77 M     78 N     79 O
80 P    81 Q     82 R     83 S     84 T     85 U     86 V     87 W
88 X    89 Y     90 Z     91 [     92 \     93 ]     94 ^     95 _
96 `    97 a     98 b     99 c    100 d    101 e    102 f    103 g
104 h   105 i    106 j    107 k    108 l    109 m    110 n    111 o
112 p   113 q    114 r    115 s    116 t    117 u    118 v    119 w
120 x   121 y    122 z    123 {    124 |    125 }    126 ~    127 DEL

• The ASCII encoding scheme in Hexadecimal:
00 NUL   01 SOH   02 STX   03 ETX   04 EOT   05 ENQ   06 ACK  07 BEL
08 BS    09 HT    0A NL    0B VT    0C NP    0D CR    0E SO   0F SI
10 DLE   11 DC1   12 DC2   13 DC3   14 DC4   15 NAK   16 SYN  17 ETB
18 CAN   19 EM    1A SUB   1B ESC   1C FS    1D GS    1E RS   1F US
20 SP    21 !     22 "     23 #     24 \$     25 %     26 &    27 '
28 (     29 )     2A *     2B +     2C ,     2D -     2E .    2F /
30 0     31 1     32 2     33 3     34 4     35 5     36 6    37 7
38 8     39 9     3A :     3B ;     3C <     3D =     3E >    3F ?
40 @     41 A     42 B     43 C     44 D     45 E     46 F    47 G
48 H     49 I     4A J     4B K     4C L     4D M     4E N    4F O
50 P     51 Q     52 R     53 S     54 T     55 U     56 V    57 W
58 X     59 Y     5A Z     5B [     5C \     5D ]     5E ^    5F _
60 `     61 a     62 b     63 c     64 d     65 e     66 f    67 g
68 h     69 i     6A j     6B k     6C l     6D m     6E n    6F o
70 p     71 q     72 r     73 s     74 t     75 u     76 v    77 w
78 x     79 y     7A z     7B {     7C |     7D }     7E ~    7F DEL

• The ASCII encoding scheme in Binary: (only a partila listing)

The following is a partial listing of the ASCII code in binary:

.....
00110000   0
00110001   1
00110010   2
00110011   3
00110100   4
00110101   5
00110110   6
00110111   7
00111000   8
00111001   9
.....
01000001   A
01000010   B
01000011   C
01000100   D
01000101   E
01000110   F
01000111   G
.....
01100001   a
01100010   b
01100011   c
01100100   d
01100101   e
01100110   f
01100111   g
.....

• Example Program: (Demo above code)

How to run the program:

 Right click on link and save in a scratch directory To compile:   gcc ascii.c To run:          a.out