a == 1 ||2 ||3 语法是不是正确
时间: 2023-09-12 11:08:54 浏览: 163
a == 1 ||2 ||3 语法是不正确的。在C语言中,逻辑运算符||的优先级低于相等运算符==。因此,表达式a == 1 ||2 ||3会先进行相等运算,即a == 1,然后再将结果与2进行逻辑或运算,最后再将结果与3进行逻辑或运算。这样的写法是不符合C语言的语法规范的。正确的写法应该是a == 1 || a == 2 || a == 3。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [若变量已正确定义并赋值,符合C语言语法的表达式是 A。a=a+7; B.a=7+b+c,a++](https://blog.csdn.net/weixin_39755136/article/details/117274173)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [PHP中$a && $b = $c,$a || $b = $c语法的用法](https://blog.csdn.net/MengJing_/article/details/123417789)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文