Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6
Here b = a++ = 7 because post increment first assign value then increase by 1 so here b = 7 and a will be 8 for a = ++b = 8 because pre increment first increase value then assign. So a = 8 and b = 8 finally c = a + b = 8 + 8 = 16
18th Mar 2020, 8:30 AM
A͢J
A͢J - avatar
+ 5
int a = 7, b = 25; int c; b = a++; // b will be 7 since a is post incremented. a = ++b; // b will become 8 and it is assigned to a, so a is also 8. c = a + b; // 8+8 cout <<c; // 16
18th Mar 2020, 8:27 AM
Avinesh
Avinesh - avatar