+ 2
What is the output of this C++ code?
int a=5, b=-2, c=2; b=--b+++a%4*c++*2; cout<<b;
8 Answers
+ 3
Dr. Doggo [D#] it's right with the compiler but I don't understand how does the output be 5.
+ 2
Dr. Doggo [D#]
and if I correct it to:
b= --b+ ++a
?
+ 2
+ 2
Martin Taylor, The last paragraph of your comment is exact. This code was a question from some exam in my university. Our teachers like to make us confuse with the hard exams, so we can try to take decisions quickly in our future job when we are confusing. This is a type of simple obstacles for us as students, and this method of teaching makes the teachers sure for us to be successful with every obstacle we find in our job in the future.