it's a comparison issue, I think paul sited a link for the two.

  ----- Original Message ----- 
  From: Lori Nagel 
  To: [email protected] 
  Sent: Friday, August 07, 2009 8:39 AM
  Subject: Re: [c-prog] plz solve


    I ran it on my computer (Linux, gcc compiler pentium 4) and I got 
  how are u

  apparently in my case double and float is not the same thing. 

  ________________________________
  From: Paul Herring <[email protected]>
  To: [email protected]
  Sent: Friday, August 7, 2009 10:25:47 AM
  Subject: Re: [c-prog] plz solve

  On Fri, Aug 7, 2009 at 11:57 AM, Uday Oberio <uday_oberio@ yahoo.co. in> 
wrote:

  > float a=1.1;
  > double b=1.1;
  > if(a==b)
  > printf("hello" );
  > else
  > printf("how are u ");
  >
  > now tell me which part will be executed

  Either one may be executed.

  > and why ?

  Because you cannot compare floats for exactness like you're trying to do.

  Have a read of <http://docs. sun.com/source/ 806-3568/ ncg_goldberg. html>



  

[Non-text portions of this message have been removed]

Reply via email to