Going backwards through my (2 weeks worth of) mail - unsure if this
has been replied to yet; gmail hasn't associated any replies to it...

On 10/5/07, Kumar Patra <[EMAIL PROTECTED]> wrote:
> Pl. help me to understand the output
>
>   #include<stdio.h>
> int main(void)
> {
>  float a=4.0;
>  int b=2;
>  printf("%f\n%d\n%f",b/a,b/a,b/a);

The result of dividing a float by an int is a float. Using any other
format specifier in a printf() string results in undefined behaviour.
Which is what you're seeing.

>  return 0;
> }
>
>   Output
> 0.500000
>   0
>   0.000000


-- 
PJH
"Statistics are like a bikini. What they reveal is suggestive, but
what they conceal is vital"
-- Aaron Levenstein

Reply via email to