0

C++ Question...

What is the difference of (a = ++b) and (a = b++)?

21st Mar 2017, 11:09 PM
Anderson Gonzaga
Anderson Gonzaga - avatar
3 Answers
+ 4
if b is 3, first a will be 4 and b will be 4. second a will be 3 and b will be 4. I think.
21st Mar 2017, 11:15 PM
윀폎
윀폎 - avatar
+ 4
For b=4 a = ++b will be implemented as b=b+1; //5 a=b; //5 a= b++ shall be worked out as a=b; //4 b=b+1; //5
22nd Mar 2017, 12:44 AM
à€Šà„‡à€”à„‡à€‚à€Šà„à€° à€źà€čà€Ÿà€œà€š (Devender)
à€Šà„‡à€”à„‡à€‚à€Šà„à€° à€źà€čà€Ÿà€œà€š (Devender) - avatar
+ 2
a =1 , b=2 a = ++b //a = 3 direct plus one a= b++ //a = b + 1 , so here b still remain 2
21st Mar 2017, 11:22 PM
Janie Lee
Janie Lee - avatar