wpe41.gif (23084 bytes)CIS3355: Business Data Structures
Fall, 2008
 

What is the difference between characters and integers?

The simple answer is NONE. As we alluded to in the previous tutorial, ASCII characters are stored as numbers (for example, the number '2' is stored as the number 50; the number '3' is stored as the number 51; the character 'e' is stored as the number 101 (which is the sum of the 'characters' '2' and '3').

Don't forget:

ASCII is merely a scheme for representing characters or symbols, ONLY!!

--- And ---

COMPUTERS ONLY WORK WITH NUMBERS!

If we look at the ASCII Table, each of the symbols represented are stored as numeric values:

NOTE:

For the first quiz, you MUST memorize (there is no other way of doing this) the corresponding decimal values for the ASCII characters:

  1. NUL (i.e., decimal 0)

  2. BEL (i.e., decimal 7)

  3. Backspace (BS; i.e., decimal 8)

  4. Carriage Return (CR; i.e., decimal 13)

  5. Escape (ESC; i.e., decimal 27)

  6. Space (SP; i.e., decimal 32)

  7. The digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (i.e., '0' = decimal 48; '1' = decimal 49; '2' = decimal 50 and so forth)

  8. The Upper case alphabet: A ,,, Z (i.e., 'A' = decimal 65; 'B' = decimal 66; 'C' = decimal 67 and so forth)

  9. The Lower case alphabet: a ... z (i.e., 'a' = decimal 97; 'b' = decimal 98; 'c' = decimal 99 and so forth)

Why ???

There are two reasons:

  1. It reinforces the distinction between characters and numeric values, and

  2. There are times, when manipulating characters, when you must deal with their numeric equivalents (for example, if you were to write a program which checked the character that the user entered, and the user enters a BS, how would you know?? There is no (single) symbol for a backspace)

Cheer up! You need to memorize only 9 integers. Start now, and you'll be ready for the test!

In the table, what is Dec, HX, Oct ??

We will get to HX (Hexadecimal) and Oct (Octal) a little later. However, for the time being, all that we need to know is that each of the ASCII characters represented is stored as an integer (Dec, or Decimal) value. Each decimal (base 10) value can, of course be associated with a binary value, which represents how the 'light switches' in the computer are set.

 How are numeric values stored??

We're getting to that.

Questions you should be able to answer:

1.  What is the difference between characters and numeric values?

a.  Characters are stored as symbols
b.  Numeric Values are stored as symbols
c.  Both are stored as numbers
d.  A and B
e.  None of the above

Answer:  c

This page was last updated on 05/28/05.