Question: Although we have concentrated on only integer, floating point, and double precision numbers, C allows characters and integers to be added or subtracted. This can

Although we have concentrated on only integer, floating point, and double precision numbers, C allows characters and integers to be added or subtracted. This can be done because C always converts a character to an equivalent integer value whenever a character is used in an arithmetic expression. Thus, characters and integers can be freely mixed in such expressions. For example, if your computer uses the ASCII code, the expression 'a' + 1 equals 'h', and 'z' - 1 equals 'y'. Similarly, 'A' + 1 is 'B', and 'z' - 1 is 'Y'. With this as background, determine the character results of the following expressions (assume that all characters are stored using the ASCII code).

a. 'm'-5

b. 'm' +5

c. 'G' +6

d. 'G'-6

e. 'h' - 'a'

f. 'g' - 'a' + 1

g. 'G' - 'A' + 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!