What will be printed out as a result of the following code execution?
int temp=0;
int x=temp++;
int y=--temp;
cout<<"x="<<x<<", y="<<y;
Explanation
Postfix increment and decrement operators while applicable to integer types return the value first and only then modify it. Prefix increment and decrement operators - modify the value first and only then then return it.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes