Hello.I am learning C++ and i don't wanna go any further beacuse I need some explanations.
1st:What is the difference between (increment): i++ and ++i
2nd:Could some1 explain functions scanf and printf
#include <iostream>
usingnamespace std;
int main()
{
int a = 5;
int b = 5;
cout << ++a << endl;
cout << b++ << endl;
return 0;
}
The output from the above program would be:
6
5
When you prefix the increment, the value is incremented before it is included in the expression. When you postfix the increment, the variable's initial value is included in the expression.
1 2 3 4 5 6 7 8 9 10
int prefix(int& i) {
i++;
return i;
}
int postfix(int& i) {
int temp = i;
i++;
return temp;
}
That would be the function equivalent (I think).
As for scanf and printf, I'm not too sure because I never use them.