According to syntax postfix increment returns copy of unmodified variable (C++ == C), while prefix increment returns incremented variable (++C == C + 1).
According to syntax postfix increment returns copy of unmodified variable (C++ == C), while prefix increment returns incremented variable (++C == C + 1).
???
If c = 1, then c++ = 2
#include <iostream> using namespace std;
int main() {
int i = 10;
cout << i++ << endl;
cout << i << endl;
}
postfix ++ increments the variable.
Postfix increments variable too, but as a side effect. in your code
cout << i++ << endl;
prints 10 which means, that i++ returned copy of unincremented i.