Question : #include<stdio.h> void main() { int y=1,z; z=y++ + y++ + y++ + y++; printf("
z = %d",z); } in the above code, the output is 4 but when the statement z=y++ + y++ + y++ + y++; is changed to z=y++ + ++y + ++y + y++; the output changes to 12. Can somebody explain how the two statements works? Thanks
In programing instruction, suppose, y=1 if z=y than value of z is 1 (because first it assign value of y to z and than increment in y by 1) and if z= y than value of z is 2 (because it increment in y by 1 and than assign that value to z) so that, in our case, z = y y y y Z = 1 3 4 4 at finally, Z = 12.
z=y++ + ++y + ++y + y++ = 1 + 3 + 4 + 4 =12. How the above values are calculated is explained below: The above expression hold y in 4 places. In first,it hold 1 and the value 1 is used in expression then incremented because it is postfix y++. Now y=2. In second term,y is incremented before it is used because it is ++y.so here y=2+1=3. In third term, y is also incremented before it is used because it is y++.so here y=3+1=4. In fourth term,y is used then only it is incremented because it is y++.so the value 4 is used here. After that the present y hold the value 4+1=5.
Why does defragment (defrag) go only so far and then stop and start over again? I get the message "Drive's Contents Have Changed: Restarting..." How can I get it to finish?