jeudi 2 février 2017

C: "If" statement doesn't work in certain conditions

I have this part of code(some stuff missing):

struct A{
  uint8_t varA;
  uint8_t varB;
...
}

struct B{
  uint8_t varC;
...    
}

...
struct A Object1 ={255, 50};
struct B Object2 ={205};

if( Object2.varC != Object1.varA - Object1.varB) || "other conditions that is false"){
   //do sth
}

Though the condition is "205 != 205 --> False" the programm enters the "do sth"-section Strangely however, if "Object1.varB = 0" and "Object2.varC = 255" it works properly as the condition is correctly False as well.

How can that be?

Aucun commentaire:

Enregistrer un commentaire