Output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Output

int i=-3,j=2,k=0,m; m=++i&&++j||++k; cout<<i<<j<<k<<m;

9th Sep 2017, 12:46 PM
JAYESH PATIDAR
JAYESH PATIDAR - avatar
6 Answers
+ 4
i=-2 j=3 k=0 m=1
9th Sep 2017, 1:21 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
m=true(stored as 1) you incremented the values while obtaining m. As for why k is still 0, the || operator skips the 2nd term if the first is true. Thus, only k is not incremented
9th Sep 2017, 1:39 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Why not run it?
9th Sep 2017, 1:20 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
but how and why
9th Sep 2017, 1:36 PM
JAYESH PATIDAR
JAYESH PATIDAR - avatar
+ 1
thanks i understand....
10th Sep 2017, 8:30 AM
JAYESH PATIDAR
JAYESH PATIDAR - avatar
0
which first term from right aur left..... coz if you incremmented k then it will print as 1 but if you doesn't then this side of && will be false
9th Sep 2017, 1:47 PM
JAYESH PATIDAR
JAYESH PATIDAR - avatar