Increement and decrement | Sololearn: Learn to code for FREE!


Increement and decrement

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


1/3/2018 9:27:05 AM


2 Answers

New Answer


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


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..