Condition expression such as those involving && and ||, do they always evaluate to 0 or 1? Or for true condition, numbers other than 1 are possible? I am asking because I want to assign a variable like this.
int a = cond1 && cond2;
I was wondering if I should do the following instead.
int a = (cond1 && cond2)? 1:0;
The logical operators (
&&,||, and!) all evaluate to either1or0.C99 §6.5.13/3:
C99 §6.5.14/3:
C99 6.5.3.3/5: