You are on page 1of 5

Characters must also be

encoded in binary

ASCII maps characters to numbers

AAS
ASCII
Math
What will print?
1. p rin tf("% d \n ", 'a' 'A ');
2. p rin tf("% c\n ", 'B ' + ('a' 'A '));
3. p rin tf("% c\n ", 'b ' ('a' 'A '));
4. p rin tf("% c\n ", 'B ' + 1);
5. p rin tf("% c\n ", ('z' 'a' + 1) % 26

+ 'a');

AAS #1
Example
Prints Z through A

1.

for (in t i = 'Z '; i > = 'A '; i--)


p rin tf("% c\n ", i);

Example #2

AAS
Converts a lowercase string to
uppercase

1.ch ar n am e[] = "m ilo";


2.for (in t i = 0, j = strlen (n am
3. f

e); i < j; i+ + )
n am e[i] = n am e[i] + ('A ' - 'a');

You might also like