0
a=100 >90 >80 ;
What is value of a
2 Réponses
+ 4
In the right hand of the assignment operator is a relational expression. That means the whole expression is gets evaluated to either 1 (true) or 0 (false). The order of evaluation is from Left-to-Right ¹. So, in an explicit manner, it would've been written as the following form:
a = (100 > 90) > 80;
Then, since 100 is greater than 90, it's going to get evaluated to 1 (true)
a = (1) > 80;
Finally, since 1 is not grater than 80, it's going to get evaluated to 0 (false)
a = 0;
_____
¹ https://en.cppreference.com/w/c/language/operator_precedence
0
what's the data-type of "a"? if it's an integer, the value is 0.