0
Guys plz explain the ++ prefix and ++postfix to me in c++
4 Answers
+ 5
int a = 2;
cout<<++a;
output will be 3 because it increments it first then it prints it
+ 4
int a = 2;
cout<<a++;
output will be 2 because first it prints the value of a then it increments it
+ 4
to see that it incremented do this :
int a = 2;
cout<<a++<<" "<<a;
output is: 2 3
0
So it will print only 2,
Where can i get the value after the increment is done?