Gifted Points (II)

1
2
int i=5;
cout<<i++<<i<<++i;

What does the above C++ code display?

Enter 999 as your answer if the results display any error.


this problem is a part of the set Fundamental Programming


The answer is 567.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Vijay Kumar
Jan 27, 2016

First increment being a post increment, just stores the i value at that instan and hence it is 5. Very next referal of i brings the incremented value from the before post increment and i is 6 here. As the next i is pre incremented, the value of i will be 7. Hence the answer will be 567.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...