+ 5
[SOLVED] Please, could you explain how the answer is 35 in this code lines? I think, it must be 42. (6*7)
int a = 5, b, c; b = (a++); c = (++a); cout << b *c;
5 Answers
+ 3
b=5 //"++" after operand is post increment. post increment means value of a will increase after the current statement is evaluated.
c=7
+ 4
Because a++ is post increment first it will assign value of a to b then it will do increment of 1 in a
+ 3
7*5= 35
b will be assigned 5
c will be assigned 7
+ 2
+ 2
int a=5,b,c;
b=(a++); // b= 5
c=(++a); // c= 7
cout<<b*c // 5*7=35