when int i; i=4; cout<<++i<<i++; plz say the output and how it works? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

when int i; i=4; cout<<++i<<i++; plz say the output and how it works?

2nd Sep 2016, 10:12 AM
balaji
balaji - avatar
4 Answers
+ 6
output: 64 because compiler reads from right to left during cascading.... i++ is 4 and I becomes 5 ++I is 6.... hence output 64
2nd Sep 2016, 10:35 AM
Piyush Yadav
Piyush Yadav - avatar
0
Ya its 64.. During cascading from right to left
2nd Sep 2016, 4:27 PM
Soutik
Soutik - avatar
- 2
according to me I think its 55
12th Sep 2016, 7:36 PM
Nitesh Yadav
Nitesh Yadav - avatar
- 2
because increments do have a concept of pre and post execution ..which means that if u are using pre-increment means ++I this is executed before the statement execution and just opposite with the post increment means increment after the statment s execution..
12th Sep 2016, 7:39 PM
Nitesh Yadav
Nitesh Yadav - avatar