0

Doubt clear me

int a=5; a=a++ + a++; printf("%d",a); ans is 11 but ++a + a++ is 13 how explain me by step

23rd Nov 2017, 3:12 AM
corejava
3 Antworten
0
6+7=13 ++a + a++ is also 13 how
23rd Nov 2017, 3:47 AM
corejava
- 1
1) depends on compiler.. 2) the compiler you are using doing like this... first a++=5(post increment)... now for the second its already 6 now... so 5+6=11 3) some compilers do like... 2 a++>> a=6>>12... 4) do this...a= ++a + ++a...; 5) tell me what you got.
23rd Nov 2017, 3:42 AM
sayan chandra
sayan chandra - avatar
- 1
means first...++a...(pre incr) 6 then ++a...(pre incr aain) 7...and add...13 sm compiler do...7+7=14
23rd Nov 2017, 3:48 AM
sayan chandra
sayan chandra - avatar