0

a=100 >90 >80 ;

What is value of a

2nd Aug 2018, 9:40 AM
vignesh K
2 Antworten
+ 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
2nd Aug 2018, 11:16 AM
Babak
Babak - avatar
0
what's the data-type of "a"? if it's an integer, the value is 0.
2nd Aug 2018, 10:44 AM
hinanawi
hinanawi - avatar