0

one of my friends asked me a question about ++ and -- operators and printing an int with cout . In his example he used kinda this code(I changed code in order to be readable):

#include <iostream>
using namespace std;
int main()
{
   int  a=5;
   cout<<a<<a++<a;
}

and the output was this:

656

Why is that and what causes this ? It should print 556 .And also it happens with -- operator too

ali73
  • 415
  • 1
  • 5
  • 17

0 Answers0