ProgrammingModerateTCS NQT · Wipro

What is printed?

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

Correct answer: D. 1

Both comparisons are true for the ASCII codes 97 < 98 < 99, so the logical AND gives 1.

More C Programming questions

Exams that ask this topic