+ 5
Can anyone just explain me in short that how do i evaluate this
int a=3 cout << a++ and cout<< ++a
4 Answers
+ 3
//Like this,
int a =3;
int x;
x=a++;
//now x is equal to '3', a's first value
//and but, a is '4'
//---
//but..
int a=3;
int x;
x = ++a;
// now both x's value and new value of a are '4'
+ 17
int a=3
cout << a++; // first, cout << a which is 3, then a = 4
cout<< ++a; // first, a = 4, then cout << a which is 4
+ 8
a++ print value and then increment it, and ++a increment value and the print it
+ 7
a++ first uses a's value then increments it
++a first increments a's value, then uses it