17
The ASCII character set
- #include <stdio.h>
- main() {
- char c = 'A';
- printf("\t c = %d - %x %o (%c)\n", c, c, c, c);
- c--;
- printf("\t c = %d - %x %o (%c)\n", c, c, c, c);
- c = 98;
- printf("\t c = %d - %x %o (%c)\n", c, c, c, c);
- c -= 'a' - 'A';
- printf("\t c = %d - %x %o (%c)\n", c, c, c, c);
- }
$ gcc -o ascii ascii.c
$ ./ascii
c = 65 - 41 101 (A)
c = 64 - 40 100 (@)
c = 98 - 62 142 (b)
c = 66 - 42 102 (B)
Comments