Question discussion

What will be the output of the following code snippet?

359237Medium DSSSB TGT Computer Science 0 replies 0 views
0
What will be the output of the following code snippet?
#include<stdio.h>
int main() {
    int a = 5, b = 3, c = 0;
    if (a > b > c) {
        printf("True\n");
    } else {
        printf("False\n");
    }
    return 0;
}
  • Acompile time error
  • Bundefined behavior
  • CTRUE
  • DFALSE
Correct answer: C

Explanation

a > b > c is evaluated as (5 > 3) > 0, that is 1 > 0, which is true, so it prints "True".

Discussion 0

Nobody has replied yet. Start the discussion!