+ 1
Can anybody please explain this program?
#include <stdio.h> int main() { int a = 15, b; b = (a++) + (a++); a = (b++) + (b++); printf("a=%d b=%d", a, b); return 0; }
2 Respostas
+ 1
Hope these will help..
Similar questions...
You can find many answers, using search bar...
https://www.sololearn.com/discuss/2976488/?ref=app
https://www.sololearn.com/Discuss/1690694/?ref=app
https://www.sololearn.com/discuss/2594788/?ref=app
https://www.sololearn.com/discuss/2924308/?ref=app
edit:
Lalitkumar Prajapat
int a=15;
b = a++ + a++ ; //15+16=31 , now a=17, first it's value uses in print and increments next.
a = (b++) + (b++) ; // 31 + 32 = 63
finally a= 63, b=33
but it may produce undefined behaviour also..
cannot predict outcome same on different compilers ( in c/c++) .
https://www.sololearn.com/Discuss/2038766/?ref=app
read these ones. hope you can clearly understand then....
0
in the first operation you can look like
b=last a + new a (15+16)=31
a=17
a=last b + new b(31+32)=63
b=33