I=j=k=1; ++i || ++j && ++k why does it increment only, and not j and k | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I=j=k=1; ++i || ++j && ++k why does it increment only, and not j and k

&& has higher precedence, shud be evaluated before ||

10th Nov 2019, 11:35 AM
Sandeep Sood
Sandeep Sood - avatar
3 Answers
+ 1
Thanx for ur reply. But sorry i m still confused. Just as u have written in ++I || ( ++j && ++k ) why && is not evaluated why bracket is not solved first Kindly explain. Thanx and regards.
10th Nov 2019, 3:38 PM
Sandeep Sood
Sandeep Sood - avatar
+ 1
Ok.. Got it. Thanx a lot.
13th Nov 2019, 1:30 AM
Sandeep Sood
Sandeep Sood - avatar
0
Short circuit is ok. It will come into picture when we have something like a||b and a is true, b need not be solved. But here my question is about precedence. Why && is not solved before || Please reply. Thanx.
12th Nov 2019, 1:55 AM
Sandeep Sood
Sandeep Sood - avatar