is it possible to make a statement like this: if( A[x] == 'a' || 'b' )
when I want to do this statement like that, I got an compiler error: if( A[x] == ( 'a' || 'b' ) )
or do I have to seperate it like this: if( A[x] == 'a' || A[x] == 'b' )
Note: A is a char array. x is any number for the array component. a and b is random characters.
true is "not zero". Operator precidence works as firedraco said, therefore'b'reduces to true
This means you have: if( (A[x] == 'a') || true)
true or anything = true so this statement reduces to: if (true)
which means you will always enter the if statement.