#include <stdio.h>
int main() {
int a = 10, b = 20, c = 30;
if (c > b > a)
printf("TRUE");
else
printf("FALSE");
return 0;
}
What happens at if(c>b>a), i know this works like if((c>b)>a),but why then false?
#include <stdio.h>
int main() {
int a = 10, b = 20, c = 30;
if (c > b > a)
printf("TRUE");
else
printf("FALSE");
return 0;
}
What happens at if(c>b>a), i know this works like if((c>b)>a),but why then false?
Operator > is left associative therefore c > b > a will be parenthesize as ((c > b) > a) . Since 30 is greater than 20, c > b = 1. So,
(c > b) > a => (1 > a) => 1 > 10 => false