1

I am having problem in understanding the output resulting from the following line:

 cout<<(a++) + (++a) + (a++);

It gives 18 for a=5 but I can't understand how? When I wrote separate output line like:

cout<<a++;
cout<<++a;
cout<<a++;

It gives the following output for a=5;

5 7 7.

What can be the reasoning behind this?

sat
  • 352
  • 2
  • 11

0 Answers0