C Compiler bug

Martin Resnick mlr0 at bunny.UUCP
Sun Jul 20 05:40:56 AEST 1986


Please try this code on your flavor of C compiler and see if you get the
correct results:
 
main()
{
   int i;
 
   i = 8;
   i = i/2.5;
   printf("i= %d\n", i);

   i = 8;
   i /= 2.5;
   printf("i= %d\n", i);
   exit(0);
}
 
The correct answer is 3 in both cases, not 4.



More information about the Comp.lang.c mailing list