Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the priority of the operator in C #

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article Xiaobian for you to introduce in detail "what is the priority of operators in C#", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "what is the priority of operators in C#" can help you solve your doubts. Let's follow the editor's ideas to learn new knowledge.

Operator precedence in C #

The precedence of the operator determines the combination of items in the expression. This affects how an expression is evaluated. Some operators have higher priority than others, for example, multiplication and division operators have higher priority than addition and subtraction operators.

For example, x = 7 + 3 times 2, where x is assigned 13 instead of 20, because the operator * has higher priority than +, so multiply 3 times 2 first, and then add 7.

The following table lists operators in order of operator precedence from high to low, with operators with higher precedence at the top of the table and operators with lower precedence at the bottom of the table. In expressions, higher priority operators are evaluated first.

The category operator associative suffix () []->. + +-- unary from left to right + -! ~ + +-- (type) * & sizeof multiply and divide from right to left * /% add and subtract from left to right +-shift from left to right > relation from left to right

< >

= equal from left to right =! = XOR from left to right and AND& from left to right XOR ^ from left to right or OR | left-to-right logic and AND&& left-to-right logic or OR | | left-to-right condition?: assignment from right to left = + =-= / =% > > =

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 295

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report