ProgrammingEasyWipro · Capgemini pattern

What is printed?

What is printed?
printf("%c %d %d", 'A' + 2, 'A' + 2, 'z' - 'a');
  1. A. C 67 26
  2. B. C 67 25
  3. C. B 66 25
  4. D. 67 C 25

Correct answer: B. C 67 25

Characters are small integers: 'A' is 65, so 'A' + 2 is 67, printed as 'C' with %c and 67 with %d. Letters are contiguous in ASCII, so 'z' − 'a' = 25 (not 26).

More C Programming questions

Exams that ask this topic