Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   help with if n condition evaluation (http://www.go4expert.com/forums/help-n-condition-evaluation-t29290/)

 IndiraP 13Nov2012 22:14

help with if n condition evaluation

i have seen at many places where condition is to be evaluated..
if(a)
{}
if(!a)
{}
for(i=0;!a;i++)
{}
if(1){}
if(!9){}

and things lyk that

can u tell me wat r the various types of conditions of if() n wat datatypes should be "a" for the above cases...???
and i knw the basic functionality of if()..!!!

 shabbir 14Nov2012 10:11

Re: help with if n condition evaluation

Can you clarify in which programming language you have seen such codes?

 IndiraP 14Nov2012 12:15

Re: help with if n condition evaluation

Quote:
 Originally Posted by shabbir (Post 98206) Can you clarify in which programming language you have seen such codes?
In C language sir..

 shabbir 14Nov2012 13:09

Re: help with if n condition evaluation

Moved thread to C Programming and each of those if statements means checking if the condition is true or false. Integer is 0 is equivalent to false.

 state 14Nov2012 16:09

Re: help with if n condition evaluation

Hello IndiraP

Suppose I have the following
Code:

```int a=5 if(a) ...```
What would such absurd looking loc(lines of code) mean?Well if you look at it closely it means "If the a has a definite value(any value other than zero) then the condition is true else the condition is false".Even a negative value or a floating point value is taken as truth value.

 IndiraP 16Nov2012 15:00

Re: help with if n condition evaluation

Quote:
 Originally Posted by state (Post 98211) Hello IndiraP Suppose I have the following Code: ```int a=5 if(a) ...``` What would such absurd looking loc(lines of code) mean?Well if you look at it closely it means "If the a has a definite value(any value other than zero) then the condition is true else the condition is false".Even a negative value or a floating point value is taken as truth value.
Thank u ..:)

 All times are GMT +5.5. The time now is 03:32.