+ 5

Can anyone just explain me in short that how do i evaluate this

int a=3 cout << a++ and cout<< ++a

11th Oct 2017, 3:51 PM
Neo
Neo - avatar
4 Respostas
+ 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'
12th Oct 2017, 8:03 PM
b_y
b_y - avatar
+ 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
11th Oct 2017, 4:07 PM
Babak
Babak - avatar
+ 8
a++ print value and then increment it, and ++a increment value and the print it
11th Oct 2017, 3:56 PM
Vukan
Vukan - avatar
+ 7
a++ first uses a's value then increments it ++a first increments a's value, then uses it
11th Oct 2017, 3:57 PM
Vranceanu Robert 🇷🇴
Vranceanu Robert 🇷🇴 - avatar