X=y=z=1. Z=++x || ++y && ++z; can someone pls explain . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

X=y=z=1. Z=++x || ++y && ++z; can someone pls explain .

C programming

11th Jul 2020, 8:00 AM
Alamelu Chandrashekar
2 Answers
0
As x=y=z=1. ++X,++y and ++z increament the value of variables before using them. Hence now x y and z become 2 each. As and has higher precedence, ++y&&++z result in true since anything which is not zero is considered true. In the same way ++x||++y&&++z give the result true. As true can be written as 1, z=1
11th Jul 2020, 10:09 AM
Dhairya
Dhairya - avatar
0
Tnx understood
12th Jul 2020, 7:54 AM
Alamelu Chandrashekar