- 1
Increments
3 Réponses
0
#include <iostream>
using namespace std;
int main(){
int a = 2;
int b = a++ + a++;
cout << a << endl;
cout << b;
}
0
Why will the value of "a" be 4
And the value of b 5 ?
0
a++ value of a is used then incremented
++a value of a is incremented then used
so.. b=2+3. =5. ( value of a becomes 3 after first increment )
and as a is incremented two times a=4