logical if in C

Ah! OK, I'm posting from a phone, so never got around to trying to compile it.
Sorry for the confusion - sometimes people don't specify the error message (like here) if there is one, and assume the compiler has done something wrong because the compiled code always executes the conditional when they think it shouldn't.

Of course, if the OP had cut and pasted the code and the error message, we'd all have saved a lot of time.