Skip to main content

Section 7.2 Characters and the ASCII code

Recall that characters are stored in the computer’s memory as numbers, namely the ASCII codes corresponding to the characters. Check this out:

Compile and run the code below in your own C environment.

#include <stdio.h>

int main (void) {
    char c = 'a';
    char d = 70;
    
    printf("The ASCII code of \'%c\' is %d.\n", c, c);
    printf("The ASCII code of \'%c\' is %d.\n", d, d);

    return(0);
}

Activity 7.1.

Please find the ASCII codes for ’a’, ’A’, ’d’, ’D’, ’s’, ’S’, ’u’, ’U’.
Do you notice any patterns with their ASCII codes?
Please type your answer below.