> 优先级高于 &
if (2 & 2 > 1)
{
// something wrong?
cout <<"I don't think this line could display..." <<endl ; // 1)
}//if
观察上述代码, 问: 语句 1) 能被执行么?
答案是: 不能执行.
2 & 2 > 1 红色部分先判断, 因为 > 优先级高于 & .
if ((2 & 2) > 1) // (2 & 2)括号不能少
{
// something wrong?
cout <<"I don't think this line could display..." <<endl ; // 1)
}//if