mercredi 1 avril 2020

Are Decimal Values Considered True in C?

I am currently writing a conditional statement that evaluates floating-point values.

float condition;
if(condition)
  // then do something
else
  // do something else

If condition is, say, 0.5 or 1/2, would the statement be considered True or False? In other words, would the program execute the "then" or the "else" portion?

Aucun commentaire:

Enregistrer un commentaire