c++ - Is cout << b || a; equivalent to (cout << b) || a;
伊谢尔伦
伊谢尔伦 2017-06-24 09:43:01
0
1
910
bool b = 0;
int a = 2;
cout << b || a;  // 0

bool b = 0;
int a = 2;
cout << (b || a);  // 1
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
过去多啦不再A梦

<< has priority 5, which is higher than ||’s priority 12.

1   ()  []  .  ->
2   !  ~   -(负号) ++  --   &(取变量地址)*   (type)(强制类型)    sizeof 
3   * / %
4   + - 
5   >> <<  
6   > >= < <= 
7   == !=   
8   &  
9   ^   
10  |   
11  &&
12  ||
13  ?:
14   =  +=  -=  *=  /=   %=  |=   ^=   &=   >>=   <<=
15  ,
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template