hi guys,i tried this thing on my turbo c compiler...actually my frnd asked me for theoutput for the code...
this is the code....
i got the output as 3Code:
apparently...the compiler is calculating i/i first and the incrementing i 2 times....but........if i directly say
it does not give me the same resultCode:
actually wat i want to ask is this....
when a division is output directly in printf,as in the case that i have give,it calculates the numerator first and then the denominator...bt,if i calculate for the division inside the main() func,and then assign the value to a variable
say something like
case 1:i get the output as 1,Code:
whereas,if i say
case 2:i get the o/p as 0;Code:
in the first case i think it is doing wat is to be done in the denominator first and then goin on to the numerator...
bt in the second one .... it does wat is in the numarator first...and then goes on to the denominator...
y does the compiler have double standards while calculating in different conditions....
any help is appreciated...
p.s.i also tried it out in the borland compiler...and got the same results...