Simple c program-please explain output.
I could not understand why it prints '20' ? please explain it !
=6 + 6 + 0 + 8 = 20
a++ becomes 0 in that situation for some reason which I do not understand
I believe the pre-decrement (or increment) will happen entirely before the final calculation. The post-increment (or decrement) will happen after the calculation. Thus:
two decrements happen first and a=5 and the increment happens after the calculation;
so: 5 + 5 + 5 + 5 = 20.
The value of 'a' after the calculation is a=6.
If you instead did:
the value of t=25 (5+5+5+5+5) and a=7.
You are essentially doing this-
|All times are GMT +1. The time now is 10:46 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.