赋值运算符与条件运算符的优先性
时间: 2023-10-23 17:34:52 浏览: 91
简单赋值运算符和表达式-c语言课件
赋值运算符的优先级高于条件运算符。赋值运算符用于将右边的值赋给左边的变量,包括=、+=、-=等。条件运算符(三元运算符)用于根据条件选择不同的值,格式为表达式1 if 条件 else 表达式2。赋值运算符在优先级上高于条件运算符,这意味着在一个表达式中,赋值运算符先于条件运算符执行。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [赋值运算符、算术运算符、关系运算符、逻辑运算符、条件运算符(三元运算符)、位运算符、运算符的优先级](https://blog.csdn.net/weixin_44170082/article/details/120990755)[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%"]
- *3* [python中运算符+的用法-Python中的运算符用法全解.pdf](https://download.csdn.net/download/qq_43966957/87895034)[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 ]
阅读全文