Suppose that x is 1. What is x after the evaluation of the following expression? (x > 1) && (x++ > 1) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Suppose that x is 1. What is x after the evaluation of the following expression? (x > 1) && (x++ > 1)

18th Nov 2020, 3:45 PM
Zaina Fannana
3 Answers
+ 2
x value must be 1 reason: if you use bit wise & it will check second condition too. but , u used Logical && so It skip the second condition when first one is false. if first condition is true then it will definitely checkes second condition .then x value is increased. for example ., (x>=1)&&(x++>1) now x value is increased by one. I hope u understand..😄
18th Nov 2020, 3:45 PM
NavyaSri
NavyaSri - avatar
0
Value of x will not change. x value will remain 1. As it is checking the condition not declaring it.
18th Nov 2020, 3:48 PM
Vinay Pal
Vinay Pal - avatar
- 1
False . In && operator the 2 conditions must be true, here x is not > 1 so this condition is false, which makes the whole statement false . I don't know what x++ means, but it's not important .
18th Nov 2020, 3:59 PM
joud