Gouutha... the only explanation i can come up is this
sum += sum++ is computed left to right... as against right to left in C. So sum always remains 0. However sum+= ++sum will give 7... Dont know whether ur getting the explanation.... But tats the only way i can think of... :D
3 comments:
Hello Gouuthaa....
see why ans 7 doesnt seem to require much logic... simple precedence knowledge gets u through to 7...
Now tell why 0 for Java code
Gouutha... the only explanation i can come up is this
sum += sum++ is computed left to right... as against right to left in C.
So sum always remains 0.
However sum+= ++sum will give 7...
Dont know whether ur getting the explanation.... But tats the only way i can think of... :D
that's right baby...
Post a Comment