The if condition getting true because 5 is aggigned to i, i.e. non-zero value is assigned in if condition. The c compiler takes it as if(1).
-Nagaraj --- Prabhjot Bharaj <[EMAIL PROTECTED]> wrote: > --- In [email protected], Saswat Praharaj > <[EMAIL PROTECTED]> > wrote: > > > > Aren't you getting a warning on line 4 of your > program ? > > > > -Saswat > > > > On Tue, 2007-02-06 at 09:38 +0000, ranjan kumar > ojha wrote: > > > int main() > > > { > > > int i=4; > > > if(i=5) > > > { > > > printf(" Hi Ranjan "); > > > } > > > return 0; > > > } > > > > > > Its answer is Hi Ranjan can anyone explain > it???? > > > > > > > > > > > > > > > > ___________________________________________________________ > ___________ > > > The all-new Yahoo! Mail goes wherever you go - > free your email > address > > > from your Internet provider. > > > > > > > > > > > > > > > Yeah, I can answer it...Its easy...The statement in > if condition returns 5 > to i, i.e. a non-zero value, so if returns true.... > For comparison of i with 5, use i==5 in if > condition... > > PRABH > > __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/
