< previous page page_630 next page >

Page 630
increments the value in freqCount [65]. If we were to take a snapshot of the freqCount array while the program was executing, we might see the array contents shown in Figure 11-11. The interpretation is that our program has encountered three A's in the input file, no B's, two C's, and so on.
In Chapter 10, we mentioned that the ASCII and EBCDIC character sets have nonprinting characters. We want to count only those characters that are printable. Therefore, not all of the array elements in freqCount will be used. If we define the named constants MIN_CHAR and MAX_CHAR as the first and last printable characters in the character set, only freqCount [MIN_CHAR] through freqCount [MAX_CHAR] will be used.
ASCII
EBCDIC
Character
Internal Representation
Character
Internal Representation
MIN_CHAR
' '
32
' '
64
MAX_CHAR
'ÿ'
126
'9'
249

3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
freqCount [MIN_CHAR] would be the counter for blanks in ASCII and EBCDIC.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
freqCount [MAX_CHAR] would be the counter for 'ÿ's in ASCII, and '9's in EBCDIC.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
freqCount [inputChar] would be the counter for whatever character inputChar contained.
0630-01.gif
Figure 11-11
freqCount Array

 
< previous page page_630 next page >