What is the difference between
private void DoSomething(int value) {
value++;
}
and
private int DoSomething(int value)
Since you are using postfix ++ the value returned is the original value of the number. Additionally since you are passing a copy of the number and not the number itself (ie by reference) the changes made to value don't affect the variable you passed.
So a program like this:
int value=1;
std::cout<
Should output as follows:
1
1
1
If you were to use prefix ++ in the returning or if you were to pass by reference in the non-returning function the same program would output as follows.
1
2
3
Hope that this helps.