Next LUG meet: 11 Oct 2003 around 4 pm - VJTI Mech Dept
-------------------------------------------------------
i came across a peculiar problem in C:

------------------------------------------------------------------------------------------------------------------------
float a = 2.5, b = 2.5;

printf ( " %f " , b++ / a + b-- ) ;
------------------------------------------------------------------------------------------------------------------------

the weirdest part is that it gives different answers depending on the
compiler used:

gcc (2.95.2) :-   3.5
turbo C         :-    4.5
jdk1.4 (gnu/linux)  :-  4.5

my problem is, if such / similar question arises in gate (IIT entrance exam
for M.Tech), what should i write?

any help regarding the actual concept of solving problems similar to the
above will be greatly appreciated.

p.s.: Let Us C - yeshwant kanithkar -> appendix A (precedence of operators)
-> increment/decrement operators,
says that increment/decrement operators act from right to left. what does
that mean?

thank you for all the help ;-)
-- 
http://mm.ilug-bom.org.in/mailman/listinfo/linuxers

Reply via email to