ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
#include <stdio.h>
int main(void) {
    char c = 'a';
    printf("%d %d", c + 1 == 'b', '9' - '0');
}
  1. A. 0 9
  2. B. 1 0
  3. C. 0 0
  4. D. 1 9

Correct answer: D. 1 9

c + 1 is the int value of 'b', so the comparison is true, giving 1. '9' - '0' is the digit value 9.

More C Programming questions

Exams that ask this topic