UC3M

Telematic/Audiovisual Syst./Communication Syst. Engineering

Systems Architecture

September 2017 - January 2018

2.7.2.  Char manipulation

Work Plan

A variable of char type represents a single character used by your computer. However, a computer can only store numeric code. Therefore, characters such as 'A', 'a', 'B', 'b' and so on, all have unique numeric code that is used by computers to represent the characters. Therefore, and given the ASCII character set, the following two assignment statements are equivalent:

char x = 'A';
char x = 65;

Furthermore, you can make operations such as:

char y = x-5

Having this into account, write a program called to_uppercase.c which, given a string up to 80 characters in lowercase, convert all characters to their uppercase counterparts. HINT: Calculate first the distance between 'a' and 'A' in ASCII notation, (which is the same as the distance between 'b' and 'B', 'c' and 'C', etc.).