0

Increement and decrement

I dont understand this int b=6, (b++==7 ) what is output

3rd Jan 2018, 9:27 AM
Aviastix
Aviastix - avatar
2 Answers
+ 17
Your question isn't clear... b++ is post increment i.e increasing value after checking the condition... thus 6==7 is False but aftee this the value of b increases by 1 thus b=7 Use this for reference https://www.sololearn.com/Discuss/407846/?ref=app
3rd Jan 2018, 9:34 AM
Frost
Frost - avatar
+ 9
int b=6; cout<<(b++==7); //outputs 0 b++ increments b on next line while ++b increments on the same line.. for eg:- int b=6; cout<<(++b==7); // this will output 1 //as b will be incremented 1st & then the operation is done.. For more u can check below post.. https://www.sololearn.com/discuss/489143/?ref=app
3rd Jan 2018, 11:53 AM
🌛DT🌜
🌛DT🌜 - avatar