ProgrammingModerateTCS NQT · Infosys

What is printed?

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

Correct answer: C. 1

'\n' is the character with value 10 and '\0' is 0, so both comparisons hold and the result is 1.

More C Programming questions

Exams that ask this topic