ProgrammingModerate

char c = 'a' + 25; printf("%c", c); What is printed on an ASCII system?

  1. A. y
  2. B. z
  3. C. a
  4. D. {

Correct answer: B. z

In ASCII the lowercase letters are consecutive from 'a' = 97, so 'a' + 25 = 122 is 'z', the 26th letter. 'y' is the off-by-one from counting 'a' as +1, and '{' is 'a' + 26. The C standard guarantees consecutive codes only for digits, hence the ASCII assumption.

More C Programming questions

Exams that ask this topic