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

C # Learning-basic introduction (3) expressions and operators in C #

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Expressions and operators in C #

An expression consists of operands and operators

Operator: +-* /%

Self-increment and self-subtraction operator: bounded _ subtractive + (take the value first, then increase); bounded _ Musi _ a (first subtract, then take the value)

Assignment operator =: you need to pay attention to the implicit conversion of the value types on the left and right sides of the assignment.

Relational (comparison) operator: > = < =! =

Logical operator: no! And & & or | (if you use & or |, the efficiency is not & &, | High efficiency)

Bit operator: bitwise and operation 5-4-4. Because 5: 00101, 4: 00100, bitwise and get 00100

Bitwise or operational 3 | 6 / 7. Because 300011,600110, bitwise or get 00111 bitwise inverse operation ~ 7 instead of-8. Because 700000111, bitwise inversion results in 11111000 bitwise XOR 10 ^ 3 = 9. Because 100010103000011, you get 001001 by bit XOR.

Shift operation: the shift to the left is to the power of * 2. Moving a few places to the right is divided by two to the power.

Special operator:

Priority of the operator: the priority of the following figure is from top to bottom, from high to low. (combination means sibling from right to left, left to right)

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: 0

*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

Servers

Wechat

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

12
Report