0% found this document useful (0 votes)
3 views5 pages

ASCII

The document discusses character encoding in binary and ASCII, providing examples of how to manipulate characters using arithmetic operations in C programming. It includes code snippets demonstrating how to print characters and convert lowercase strings to uppercase. The document emphasizes the relationship between ASCII values and character manipulation.

Uploaded by

Lyall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

ASCII

The document discusses character encoding in binary and ASCII, providing examples of how to manipulate characters using arithmetic operations in C programming. It includes code snippets demonstrating how to print characters and convert lowercase strings to uppercase. The document emphasizes the relationship between ASCII values and character manipulation.

Uploaded by

Lyall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Characters must also be

encoded in binary
ASCII maps characters to numbers
AAS
ASCII Math

What will print?

1. printf("%d\n", 'a' – 'A');


2. printf("%c\n", 'B' + ('a' – 'A'));
3. printf("%c\n", 'b' – ('a' – 'A'));
4. printf("%c\n", 'B' + 1);
5. printf("%c\n", ('z' – 'a' + 1) % 26 +
'a');
AAS #1
Example
Prints Z through A

1. for (int i = 'Z'; i >= 'A'; i--)


printf("%c\n", i);
Example #2
AAS
Converts a lowercase string to
uppercase

1. char name[] = "milo";


2. for (int i = 0, j = strlen(name); i < j; i++)
name[i] = name[i] + ('A' - 'a');
3. f

You might also like